Skip to content

erman123456/fastify-nx-technical-test

Repository files navigation

FastifyNxTechnicalTest

This workspace has been generated by Nx, a Smart, fast and extensible build system.

Development server

Run nx serve nestjs for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Understand this workspace

Run nx graph to see a diagram of the dependencies of the projects.

Remote caching

Run npx nx connect-to-nx-cloud to enable remote caching and make CI faster.

Further help

Visit the Nx Documentation to learn more.

Build a REST API with Fastify & NX monorepo

What are we using?

  • Fastify - Web server
  • NX - Monorepo
  • Postgres - Database
  • Swagger - API docs
  • TypeScript - Types & other cool stuff

What will I need?

Features

  • News CRUD
  • Topic CRUD
  • Authentication
  • Request & response validation (Schema)
  • Swagger docs

Where can I learn more about testing Fastify?

step building

fastify create

  • Run npm i fastify-cli to install fastify cli
  • Run fastify generate project_name --lang=ts to create project with typescript language
  • Run npm i to install all package
  • Run npm run dev to run project

fastify create with nx monorepo

  • Run npx create-nx-workspace workspace_name to create project with NX monorepo
  • install extension nx-plugin
  • Run mkdir modules as feature dir
  • Run npx nx g @nrwl/node:library library_name --director=modules or generate library with NX plugin
  • Run nx serve workspace_name for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.
  • Run nx e2e api-e2e (e2e project) to run test api e2e

library addition

  • Run npm i prisma to orm database
  • Run npm i fastify-zod" to schema validation with static type inference
  • Run npm i fastify/swagger to openAPI schema

how do I try project run well?

  • After run project open url : http://localhost:3000/swagger/ fastify test server
  • Base url http://localhost:3000/api/ to test using postman or insomnia

About

Technical Test Zero One Group

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published