Skip to content

guilhermemntt/fastify-mongo-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fastify-mongo-boilerplate

Deploy a Node.js server very quickly with Fastify and MongoDB.

File structure

  • 📁 dist/
  • 📁 node_modules/
  • 📂 src/
    • 📁 controllers/
    • 📂 types/
      • 📄 index.type.ts
    • 📂 routes/
      • 📄 index.route.ts
    • 📂 services/
      • 📄 index.service.ts
      • 📄 aws.service.ts
      • 📄 emailer.service.ts
      • 📄 fastify.service.ts
      • 📄 firebase.service.ts
      • 📄 redis.service.ts
      • 📄 mongo.service.ts
    • 📄 index.ts
  • 📄 example.env
  • 📄 package.json
  • 📄 postman.json
  • 📄 README.md
  • 📄 tsconfig.json
  • 📄 yarn.lock

Run

First of all, install typescript and nodemon gobally with yarn.

  1. At the repository root, download the dependencies with yarn:
yarn
  1. Rename the file example.env to .env, and edit the environment variables. Some of them are required when using Fastify and TypeORM as JWT_SECRET,SERVER_PORT and MONGO_ ones.

  2. Make sure you're running your database service. Create your collection types in types/index.type.ts.

  3. Add aditional services at index.ts services array, if necessary.

  4. Add aditional *.route.ts files into index.route.ts routes array, if necessary.

  5. Run tsc -w at project root directory.

  6. Additionally, run nodemon at dist/ directory.

  7. Edit src/ TypeScript code with automatic reload!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published