๐ A boilerplate for Node.js, Fastify, TypeScript, Vite, Playwright, and Render.
๐ Live Demo - The client application is here.
Get started with Fastify Starter.
# dev server
$ pnpm install
$ pnpm dev
# mock server
$ cd mock/requests && pnpm install && cd ../..
$ pnpm mock
Follow steps to execute this boilerplate.
$ pnpm install
$ pnpm dev
$ pnpm build
Files: src/**/*.ts
$ pnpm lint
Files: src/**/*.spec.ts
$ pnpm unit
Files: e2e/**/*.spec.ts
# Before running the `e2e` command, make sure to run the following commands.
$ pnpm build
$ pnpm preview
# If it's not installed, run it.
$ cd e2e && pnpm install && cd ..
$ pnpm e2e
Files: benchmark/**/*.spec.ts
# If it's not installed, run it.
$ cd benchmark && pnpm install && cd ..
$ pnpm bench
# If it's not installed, run it.
$ cd mock/requests && pnpm install && cd ../..
$ pnpm mock
Files: docs/**/*.md
# If it's not installed, run it.
$ cd docs && pnpm install && cd ..
$ pnpm doc
This seed repository provides the following features:
- ---------- Essentials ----------
- Fastify - Web Application Framework
- MongoDB - Document Database
- JWT - Authentication
- PBKDF2 - Hash Passwords
- OTP - Authenticator
- Cloudinary - Asset Management
- I18n - Internationalization and Localization
- Redis - In-memory Data Structure Store
- WebSocket - Two-way Interactive Communication Session
- EventSource - Server-sent Events
- Mailer - Email Sending
- Email - Email Builder
- Nunjucks - Email Rendering
- Sheets - Spreadsheet Data Toolkit
- BullMQ - Message Queue
- ---------- Tools ----------
- Vite - Bundler
- TypeScript - JavaScript with Syntax for Types
- ESLint - Linter
- Prettier - Formatter
- Vitest - Test Runner
- Playwright - Test Automation
- Autocannon - Measure Performance
- VitePress - Documentation
- ---------- Environments ----------
- Node.js - JavaScript Runtime Environment
- Pnpm - Package Manager
- PM2 - Process Manager
- Caddy - Web Server
- Docker - Containerized Application Development
- CircleCI - Continuous Integration and Delivery
- Render - Cloud Application Hosting
Control the environment.
Set your local environment variables.
// env.ts
export default {
NODE_ENV: process.env.NODE_ENV || 'development',
HOST: process.env.HOST || '127.0.0.1',
PORT: process.env.PORT || 3000,
SITE_URL: process.env.SITE_URL || 'http://127.0.0.1:5173',
MONGODB_URL: process.env.MONGODB_URL || 'xxx',
REDIS_URL: process.env.REDIS_URL || 'xxx',
CLOUDINARY_URL: process.env.CLOUDINARY_URL || 'xxx',
SMTP_URL: process.env.SMTP_URL || 'xxx',
SECRET_KEY: process.env.SECRET_KEY || 'xxx',
};
Add environment variables to the CircleCI build.
# production
DEPLOY_HOOK=xxx
# development
DEV_DEPLOY_HOOK=xxx
# staging
STAGE_DEPLOY_HOOK=xxx
Add environment variables to the Render build.
SITE_URL=xxx
MONGODB_URL=xxx
REDIS_URL=xxx
CLOUDINARY_URL=xxx
SMTP_URL=xxx
SECRET_KEY=xxx
The structure follows the LIFT Guidelines.
.
โโโ .circleci
โโโ benchmark
โโโ docs
โโโ e2e -> e2e testing (Caddy Server proxy api and proxy mock api)
โโโ mock
โ โโโ requests -> mock api
โ โโโ responses -> mock data for mock api, unit testing, and e2e testing
โโโ public -> not handled by vite, copy it to dist
โโโ src
โ โโโ assets -> wasm
โ โโโ components -> shared module
โ โโโ composables -> shared module
โ โโโ locales -> core module
โ โโโ middleware -> core module
โ โโโ modules -> feature modules
โ โ โโโ <FEATURE> -> feature module
โ โ โโโ __tests__ -> unit testing
โ โ โโโ _locales
โ โ โโโ controller.ts
โ โ โโโ registry.ts -> route component
โ โ โโโ schema.ts
โ โ โโโ service.ts
โ โ โโโ types.ts
โ โโโ plugins -> root module
โ โโโ templates -> email templates with nunjucks
โ โโโ utilities -> shared module
โ โโโ app.ts
โ โโโ error.ts
โ โโโ main.ts
โ โโโ shims.d.ts
โโโ .editorconfig
โโโ .eslintrc
โโโ .gitignore
โโโ .prettierrc
โโโ Caddyfile
โโโ docker-compose.yml
โโโ Dockerfile
โโโ env.ts
โโโ index.ts -> entrypoint
โโโ LICENSE
โโโ package.json
โโโ pnpm-lock.yaml
โโโ README.md
โโโ render.yaml
โโโ tsconfig.json
โโโ vite.config.ts
A microservice architecture โ a variant of the service-oriented architecture structural style โ is an architectural pattern that arranges an application as a collection of loosely-coupled, fine-grained services, communicating through lightweight protocols.
See Micro-Fullstack's Micro Backends for instructions on how to create microservices from source code.
api.example.com
โโโ /auth
โ โโโ auth.api.example.com
โโโ /stats
โ โโโ stats.api.example.com
โโโ /todoist
โ โโโ todoist.api.example.com
โโโ /feature
โ โโโ feature.api.example.com
โโโ /files
โ โโโ files.api.example.com
โโโ /settings
โโโ settings.api.example.com