Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gkampitakis/fastify-template-server
Template for spinning up a fastify server
https://github.com/gkampitakis/fastify-template-server
docker fastify nodejs server template typescript
Last synced: about 1 month ago
JSON representation
Template for spinning up a fastify server
- Host: GitHub
- URL: https://github.com/gkampitakis/fastify-template-server
- Owner: gkampitakis
- License: mit
- Created: 2020-10-03T07:12:56.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-08T20:07:11.000Z (almost 2 years ago)
- Last Synced: 2023-03-06T06:37:12.809Z (almost 2 years ago)
- Topics: docker, fastify, nodejs, server, template, typescript
- Language: TypeScript
- Homepage:
- Size: 1.07 MB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Fastify Template Server
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/gkampitakis/fastify-template-server/graphs/commit-activity)
## Description
A template fastify server with basic functionality and structure ready to fork and spin up a server.
## Contents
This repository is ready to start developing. You can find `controllers` folders where you can register routes and start creating your api.
Inside this repo you can find `*.spec` test files and a basic `*.integration` file. In `package.json` it is specified `100%` coverage you can tweak this number to meet your needs.
In the root folder there is also two Dockerfiles, one for development `Dockerfile.dev` and the `Dockerfile` for production.
You can find to env file, `.env.example`. You can run `cp .env.example .env` and start working locally.
> ⚠️ .env file is not ported inside Dockerfile
Finally there is a folder `/kubernetes` containing a basic `yaml` file for creating a `Deployment` and `Service` for running your server in Kubernetes.
## Usage
### Locally
In order to run this server locally you need to install dependencies with `npm install`
and then `npm run start`.### Docker
Build Image:
```bash
docker build . -t fastify-template
# or the dev image
docker build . -f Dockerfile.dev -t fastify-template
```#### Run Development Image
You can run development Docker and develop your code in two ways
```bash
docker run -p : --name fastify-template fastify-template
# or with live reload support
docker run -p : --name fastify-template -v /app/node_modules -v ${PWD}:/app fastify-template
```### Run Production Image
```bash
docker run --rm -p : --name fastify-template fastify-template
```## Useful Resources
- [Fastify Example](https://github.com/delvedor/fastify-example)
a small but feature complete application build with Fastify and Svelte,which aims to show all the core concepts of Fastify, best practices, and recommendations from one of the creators of Fastify.
- [10 Best Practices to containerize NodeJS web application with docker](https://snyk.io/blog/10-best-practices-to-containerize-nodejs-web-applications-with-docker/).## License
MIT License