A Node.js TypeScript project with Fastify to create a performant and modern API.
- Fastify : Fast and efficient web framework for Node.js
- TypeScript : Static typing and modern development
- ESModule : Native ES6 modules support
- JWT Authentication : JWT authentication support
- CORS : Cross-Origin Resource Sharing support
- Cookie Support : Built-in cookie management
- ESLint : Linting with latest TypeScript rules
- Prettier : Automatic code formatting
- Hot Reload : Automatic reload in development with
tsx
- Node.js 18+
- npm or yarn
npm installnpm run dev- Start the server in development mode with hot reloadnpm run build- Compile TypeScript to JavaScriptnpm start- Start the server in production modenpm run lint- Check code with ESLintnpm run lint:fix- Automatically fix ESLint errorsnpm run format- Format code with Prettiernpm run type-check- Check TypeScript types without compilation
npm run devnpm run build
npm startGET /api- API root endpoint with version information
GET /api/status- API status with uptime
POST /api/auth/signup- Sign up (not implemented)POST /api/auth/signin- Sign in (not implemented)POST /api/auth/logout- Logout (not implemented)
The server can be configured via the .env file at the project root and the config folder in the src directory.
starter-fastify-api/
βββ src/
β βββ index.ts # Main entry point with FastifyAPIStarter class
β βββ config/
β β βββ index.ts # Server configuration
β βββ routes/
β β βββ auth/
β β β βββ index.ts # Authentication routes
β β βββ index/
β β β βββ index.ts # Main API route
β β βββ status/
β β βββ index.ts # Status route
β βββ types/
β βββ index.ts # TypeScript types
βββ dist/ # Compiled code (generated)
βββ .prettierrc # Prettier configuration
βββ .prettierignore # Files ignored by Prettier
βββ eslint.config.js # ESLint configuration (v9)
βββ tsconfig.json # TypeScript configuration
βββ package.json # Dependencies and scripts
- Node.js - JavaScript runtime
- Fastify 5 - Ultra-fast web framework
- TypeScript - Programming language
- @fastify/jwt - JWT plugin for authentication
- @fastify/cors - CORS plugin
- @fastify/cookie - Cookie support
- ESLint 9 - Linter with flat config configuration
- Prettier 3 - Code formatter
- tsx - TypeScript runtime for development
This project is distributed under the GNU General Public License v3.0.
See the LICENSE file for more information.