/mv-api-typescript

Backend restapi for mv-frontend(Rewrite)

Primary LanguageTypeScript

Banner

GitHub code size in bytes GitHub last commit GitHub commit activity month GitHub license

📌 Overview

mv-api-typescript is a backend REST API project that serves as the rewrite for the mv-frontend application. It utilizes various essential dependencies such as Prisma, NestJS, Axios, and Passport for authentication. Other notable dependencies include bcrypt for password hashing, class-transformer and class-validator for data validation, and Swagger for API documentation. The project also includes testing frameworks like Jest and Supertest, as well as linting tools like ESLint and Prettier.

🔍 Table of Contents

📁 Project Structure

├── .env.example
├── .eslintrc.js
├── .gitignore
├── .prettierrc
├── README.md
├── nest-cli.json
├── package-lock.json
├── package.json
├── prisma
│   ├── dbml
│   │   └── schema.dbml
│   ├── migrations
│   │   ├── 20220601233524_init_db
│   │   │   └── migration.sql
│   │   └── migration_lock.toml
│   └── schema.prisma
├── src
│   ├── app.controller.spec.ts
│   ├── app.controller.ts
│   ├── app.module.ts
│   ├── app.service.ts
│   ├── auth
│   │   ├── auth.controller.spec.ts
│   │   ├── auth.controller.ts
│   │   ├── auth.module.ts
│   │   ├── auth.service.spec.ts
│   │   ├── auth.service.ts
│   │   ├── dto
│   │   │   ├── jwt.dto.ts
│   │   │   └── login.dto.ts
│   │   └── password
│   │       ├── jwt.strategy.ts
│   │       ├── password.service.spec.ts
│   │       └── password.service.ts
│   ├── common
│   │   ├── CONSTANTS.ts
│   │   ├── config
│   │   │   ├── config.interface.ts
│   │   │   └── config.ts
│   │   ├── decorators
│   │   │   ├── public.decorator.ts
│   │   │   ├── role.decorator.ts
│   │   │   └── status.decorator.ts
│   │   ├── dtos
│   │   │   └── create-user.dto.ts
│   │   ├── guards
│   │   │   ├── jwt.guard.spec.ts
│   │   │   ├── jwt.guard.ts
│   │   │   ├── role.guard.spec.ts
│   │   │   ├── role.guard.ts
│   │   │   ├── status.guard.spec.ts
│   │   │   └── status.guard.ts
│   │   ├── middleware
│   │   │   └── logging.middleware.ts
│   │   ├── models
│   │   │   ├── req.model.ts
│   │   │   ├── token.model.ts
│   │   │   └── user.model.ts
│   │   └── types
│   │       └── user.model.ts
│   ├── healthcheck
│   │   ├── db.healthcheck.ts
│   │   └── status.healthcheck.ts
│   ├── main.ts
│   └── users
│       ├── dto
│       │   └── update-user.dto.ts
│       ├── users.controller.spec.ts
│       ├── users.controller.ts
│       ├── users.module.ts
│       ├── users.service.spec.ts
│       └── users.service.ts
├── test
│   ├── app.e2e-spec.ts
│   └── jest-e2e.json
├── tsconfig.build.json
└── tsconfig.json

📝 Project Summary

💻 Stack

⚙️ Setting Up

POSTGRES_USER

  • Choose a username for the PostgreSQL database.
  • Ensure that the username follows the naming conventions and security best practices.
  • Use a secure password for the user account.
  • Avoid using common or easily guessable usernames.

POSTGRES_PASSWORD

  • Generate a strong and secure password for the PostgreSQL user account.
  • Use a combination of uppercase and lowercase letters, numbers, and special characters.
  • Ensure that the password is not easily guessable or common.
  • Consider using a password manager to generate and store the password securely.

POSTGRES_DB

  • Decide on a name for the PostgreSQL database.
  • Choose a name that reflects the purpose or content of the database.
  • Ensure that the database name follows the naming conventions and guidelines.
  • Avoid using reserved keywords or special characters in the database name.

DB_HOST

  • If running locally, set the value to the hostname or IP address of the PostgreSQL database server.
  • If running in a Docker container, set the value to the hostname or container name of the PostgreSQL database container.

DB_PORT

  • Specify the port number on which the PostgreSQL database server is running.
  • The default port for PostgreSQL is 5432.
  • If using a non-default port, provide the appropriate port number.

JWT_ACCESS_SECRET

  • Generate a secure secret key for signing access tokens.
  • Use a random string of characters with sufficient length.
  • Store the secret key securely and avoid sharing it publicly.

JWT_REFRESH_SECRET

  • Generate a secure secret key for signing refresh tokens.
  • Use a random string of characters with sufficient length.
  • Store the secret key securely and avoid sharing it publicly.

🚀 Run Locally

1.Clone the mv-api-typescript repository:

git clone https://github.com/Braggedtooth/mv-api-typescript

2.Install the dependencies with one of the package managers listed below:

pnpm install
bun install
npm install
yarn install

3.Start the development mode:

pnpm dev
bun dev
npm run dev
yarn dev

Api documentation by swagger

🙌 Contributors

☁️ Deploy

[Application name](Your App URL)

📄 License

Add Your License