Git Product home page Git Product logo

fastify-template's Introduction

Fastify template

This project template serves as a starting point for building efficient and scalable server-side applications with Fastify, TypeScript, and best practices in place. It comes pre-configured with essential tools to ensure code quality, maintainability, and a streamlined development workflow.

Package License

Installation

npm ci

Prerequisites

Create a .env file in the root directory if one does not already exist and copy the contents of the desired environment file over. (.env.development or .env.production)

Running the app

# Development in watch mode
npm run dev

# Production mode
npm run build && npm run start

With Docker

docker build -t fastify-template . && docker run fastify-template

With Docker Compose

# There are multiple profiles that can be run:
# dev -> Mounts the current directory to the container and runs the service in watch mode
# local -> Builds and runs the application image from the current code
docker compose --profile=PROFILE up --build

Database

The database can be accessed via a browser by navigating to API_URL:8080 when running Docker Compose with the dev profile.

Note that you may need to run npx prisma migrate dev --name init in your terminal if you haven't already initialized the database. This only needs to be done the first time the database is created. (Or whenever the database has been recreated)

Endpoints documentation (API specification)

Once the app is running, documentation will be available at API_URL:PORT/docs.

Test

# Unit tests
npm run test

# Test coverage
npm run test:coverage

# E2E tests
npm run test:e2e

License

This project is licensed under the MIT License. Feel free to customize and use it for your own projects.

fastify-template's People

Contributors

stijnklomp avatar

Watchers

 avatar

fastify-template's Issues

Testing

  • Unit tests
  • Feature tests?
  • Acceptance tests (Setup only. No actual tests required)

Look into contract testing so there is no need for integration tests.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.