Skip to main content

Getting Started

This set of articles covers the core fundamentals of Vramework. To understand how Vramework operates, a basic CRUD application will be built, demonstrating fundamental features at an introductory level.

Prerequisites

Ensure that Node.js (version >= 18) is installed on the operating system.

Setup

Begin by installing the starter project using Git:

# Clone the project
git clone https://github.com/vramework/express-middleware-starter.git project
# Enter the directory
cd project
# Setup dependencies
npm install
# Run vramework cli
npx @vramework/cli

The project directory will be created, node modules will be installed, and vramework files will be created:

Project structure
.vramework/
vramework-schemas/
schemas/
CreateBook.schema.json
JustBookId.schema.json
register.ts
vramework-bootstrap.ts
vramework-routes-map.d.ts
vramework-routes.ts
vramework-types.d.ts
bin/
main.ts
src/
config.ts
services.ts
books.service.ts
books.function.ts
types/
books.types.d.ts
vramework.config.json

Core Files

Here's a brief overview of there core files:

FileDescription
main.tsThe entry point
config.tsThe configuration used by the server
services.tsA function that creates all the expected services required
book.service.tsA simple book service
books.function.tsThe glue between services and http calls
vramework.config.jsonThe config used by the vramework CLI tool

Generated Files

info

The two files we use are vramework-bootstrap.ts and vramework-types.d.ts. The rest are generated in order to either help provide autocompletion / type checks or for runtime purposes.

FileDescription
vramework-schemas/The directory that contains all the schemas we'll validate calls against
vramework-schemas/register.tsImports all the schemas and adds them to vramework
vramework-bootstrap.tsImports the required files into our runtime
vramework-routes.tsImports all the files with routes in them
vramework-types.d.tsProvides types to be used in the application

The config file

The vramework.config.json file is used to drive the vramework CLI tool.

info

The vramework CLI tool is used to:

  • Index all your API routes.
  • Generate the route schemas.
  • Create typescript declaration files to aid developers.

For more info you can checkout the CLI documentation.

vramework.config.json
loading...