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.