CompassCar is an API that provides server handling for a car rental business.
The project folder consists of the following files and directories:
/AWS_NODE_AGO24_DESAFIO_02_ALFRED
│
├──/docs
│
├──/src
│ │
│ ├──/@types
│ │
│ ├──/database
│ │ ├──/migrations
│ │ ├──/seed
│ │ └──/utils
│ │
│ ├──/errors
│ │
│ ├──/modules
│ │ │
│ │ ├──/auth
│ │ │ ├──/controllers
│ │ │ ├──/interfaces
│ │ │ ├──/middlewares
│ │ │ ├──/routes
│ │ │ └──/services
│ │ │
│ │ ├──/cars
│ │ │ ├──/controllers
│ │ │ ├──/entities
│ │ │ ├──/interfaces
│ │ │ ├──/middlewares
│ │ │ ├──/repositories
│ │ │ ├──/routes
│ │ │ ├──/services
│ │ │ └──/utils
│ │ │
│ │ ├──/customers
│ │ │ ├──/controllers
│ │ │ ├──/entities
│ │ │ ├──/interfaces
│ │ │ ├──/middlewares
│ │ │ ├──/repositories
│ │ │ ├──/routes
│ │ │ └──/services
│ │ │
│ │ ├──/orders
│ │ │ ├──/controllers
│ │ │ ├──/entities
│ │ │ ├──/interfaces
│ │ │ ├──/repositories
│ │ │ ├──/routes
│ │ │ ├──/services
│ │ │ └──/utils
│ │ │
│ │ └──/users
│ │ ├──/controllers
│ │ ├──/entities
│ │ ├──/interfaces
│ │ ├──/repositories
│ │ ├──/routes
│ │ ├──/services
│ │ └──/utils
│ │
│ ├── app.ts
│ └── server.ts
│
├── .editorconfig
├── .env.example
├── .gitignore
├── .prettierrc.json
├── docker-compose.yaml
├── eslint.config.mjs
├── package-lock.json
├── package.json
├── pnpm-lock.yaml
├── README.md
└── tsconfig.json
-
/docs: Application documentation. -
/src: Application source code./@types: Custom type definitions./database: Database management./migrations: Database migration files./seed: Scripts to seed the database./utils: Database utilities.
/errors: Custom error handling and definitions./modules: Application domain modules./auth,/cars,/customers,/orders,/users: Management of different system entities./controllers: Handles requests and responses./entities: Domain entity definitions./interfaces: Type declarations and contracts./middlewares: Middleware logic (validations, authentication, etc.)./repositories: Database access and manipulation./routes: API route definitions./services: Business logic./utils: Utility functions specific to each domain.
app.ts: Main application file.server.ts: Server initialization.
-
.editorconfig: Editor configuration settings. -
.env.example: Example environment variables file. -
.gitignore: Files/folders ignored by Git. -
.prettierrc.json: Prettier formatting configuration. -
docker-compose.yaml: Docker container definitions. -
eslint.config.mjs: ESLint configuration. -
package.json: Project dependencies and scripts. -
pnpm-lock.yaml: PNPM lock file. -
README.md: Main application documentation. -
tsconfig.json: TypeScript configuration.
git clone https://github.com/RogerioCordeiro/AWS_NODE_AGO24_DESAFIO_02_ALFRED.git cd AWS_NODE_AGO24_DESAFIO_02_ALFREDCreate a .env file in the root directory of your project. You can use the .env.example file as a template. Copy the contents of .env.example to create your own .env file.
Edit the .env file and set the values for the following variables:
POSTGRES_USER=
POSTGRES_PASSWORD=
POSTGRES_DB=
DATABASE_URL=
DOCKER_VOLUMES=
SEED_USER_NAME=
SEED_USER_EMAIL=
SEED_USER_PASSWORD=
JWT_EXPIRES_IN=
JWT_SECRET=
API_PORT= docker-compose up- Using npm
npm run typeorm:run- Using pnpm
pnpm typeorm:run- Using npm
npm run dev- Using pnpm
pnpm devThe API documentation is available at http://localhost:${API_PORT}/api-docs.