A modern command-line tool for quickly scaffolding Express.js applications with TypeScript or JavaScript
Generate complete project structures with authentication, MongoDB integration, and best practices ready to use!
Installation β’ Quick Start β’ Features β’ Documentation β’ Contributing
Tin is the fastest way to scaffold production-ready Express.js projects with TypeScript or JavaScript. Whether you're building RESTful APIs, web applications, or microservices, Tin provides everything you need to get up and running quickly with battle-tested patterns and practices.
- β‘ Generate Express.js REST APIs in one command
- π Choose TypeScript or JavaScript templates
- π Flexible Authentication Options:
- π JWT Authentication (header-based)
- πͺ Cookie-based JWT for enhanced security
- π¦ MongoDB integration with Mongoose
- π Swagger UI with OpenAPI documentation (optional, dark mode)
- π³ Optional Docker setup generation
- π Modular architecture with best practices
- π οΈ Pre-configured development environment
- π Error handling middleware ready to use
- π Auto-generated
.envfiles with secure defaults
npm install -g create-tinnpx create-tin my-api-project# Using the installed package
create-tin my-api-project
# Or using npx
npx create-tin my-api-project- Choose language (TypeScript or JavaScript)
- Select authentication method (JWT or Cookie-based)
- Initialize Git repository
- Set the server port
- Add Docker configuration
Usage: create-tin [options] [project-name]
Options:
--ts Generate a TypeScript project template
--js Generate a JavaScript project template
--jwt Use JWT-based authentication (tokens in Authorization header)
--cookies Use Cookie-based authentication (JWT stored in HTTP-only cookies)
--git Initialize a new Git repository
--skip-git Skip Git initialization
--port <number> Set the server port (default: 3000)
--docker Include Docker configuration
--skip-docker Skip adding Docker configuration
--swagger Include Swagger UI with OpenAPI documentation (dark mode)
--skip-swagger Skip adding Swagger UI
-h, --help Display this help messageπ‘ Tip: Use the
--swaggerflag to automatically add API documentation with Swagger UI to your project. The documentation comes pre-configured with a dark mode theme and includes example endpoints for authentication.
# Create a TypeScript project with JWT auth, Git and Docker configuration
create-tin my-ts-api --ts --jwt --git --docker
# Create a JavaScript project with cookie-based auth without Git and Docker
create-tin my-js-api --js --cookies --skip-git --skip-docker --port 5000
# Create a TypeScript project with JWT auth, Git, Docker and Swagger UI
create-tin api-docs --ts --jwt --git --docker --swaggerWhen you create a project with the --swagger flag, your API will automatically be configured with Swagger UI documentation. After starting your server, you can access the API documentation at:
http://localhost:PORT/api-docs
The documentation includes:
- Authentication endpoints (register, login)
- Interactive testing capabilities
- Request/response examples
- Dark mode UI for better readability
- Full-page responsive design
The Swagger UI integration is fully customizable:
- Edit the API specification in
src/docs/openapi.yaml - Customize the dark theme in
src/styles/swagger-dark.css - Configure Swagger UI options in
src/config/swagger.ts(or.js)
If you choose to include Swagger UI when generating your project, your API will have built-in interactive documentation available at /api-docs.
- Interactive API Explorer: Test your API endpoints directly from the browser
- Dark Mode UI: Modern interface with dark theme for better readability
- OpenAPI 3.0: Documentation follows OpenAPI 3.0 specification
- Authentication Documentation: Includes auth endpoints with request/response examples
- Fully Responsive: Works well on all screen sizes
- Customizable: Easy to modify the OpenAPI spec to match your API
- Start your server with
npm run devornpm start - Navigate to
http://localhost:PORT/api-docsin your browser - Explore the interactive documentation
- Test endpoints directly from the UI
- The OpenAPI specification file is located at
src/docs/openapi.yaml - CSS styling can be customized in
src/styles/swagger-dark.css - Configure Swagger UI options in
src/config/swagger.ts(orswagger.js)
TypeScript Project Structure
my-api-project/
βββ src/
β βββ config/
β β βββ db.ts
β β βββ swagger.ts (if Swagger UI option selected)
β βββ controllers/
β β βββ authController.ts
β βββ middlewares/
β β βββ errorHandler.ts
β β βββ verifyToken.ts
β βββ models/
β β βββ userModel.ts
β βββ docs/
β β βββ openapi.yaml (if Swagger UI option selected)
β βββ styles/
β β βββ swagger-dark.css (if Swagger UI option selected)
β βββ routes/
β β βββ authRoutes.ts
β βββ types/
β β βββ constants.ts
β β βββ index.d.ts
β βββ index.ts
βββ .env
βββ .env.example
βββ .gitignore
βββ package.json
βββ tsconfig.json
βββ README.md
JavaScript Project Structure
my-api-project/
βββ src/
β βββ config/
β β βββ db.js
β β βββ swagger.js (if Swagger UI option selected)
β βββ controllers/
β β βββ authController.js
β βββ middlewares/
β β βββ errorHandler.js
β β βββ verifyToken.js
β βββ models/
β β βββ userModel.js
β βββ docs/
β β βββ openapi.yaml (if Swagger UI option selected)
β βββ styles/
β β βββ swagger-dark.css (if Swagger UI option selected)
β βββ routes/
β β βββ authRoutes.js
β βββ index.js
βββ .env
βββ .env.example
βββ .gitignore
βββ package.json
βββ README.md
When Docker configuration is enabled, the following files are generated:
| File | Description |
|---|---|
Dockerfile |
Optimized multi-stage build |
docker-compose.yml |
Docker Compose setup |
.dockerignore |
Ignores unnecessary files |
After generating your project:
# Navigate to your project directory
cd my-api-project
# Install dependencies
npm install
# Start the development server
npm run devποΈ Express.js REST API
Clean architecture structure ready to use
π Authentication Options
Choose between:
- JWT Authentication - Traditional token-based auth via headers
- Cookie-based JWT - Enhanced security with HTTP-only cookies
π MongoDB Integration
Complete setup with Mongoose ODM
π API Documentation
- Swagger UI Integration - Interactive API explorer
- Dark Mode Interface - Modern and readable design
- OpenAPI 3.0 - Comprehensive API specification
- Pre-configured Auth Routes - Ready to test and extend
π§ Environment Variables
- Auto-generated
.env- Ready to use with secure JWT secrets- Context-aware configuration - Adapts to Docker, Swagger, and port settings
.env.exampleincluded - Template for deployment reference
β οΈ Error Handling
Professional middleware implementation
π TypeScript Support
Type definitions (TypeScript template only)
- Fast Development Start: Get a fully configured Express.js project in seconds
- Production Ready: Templates follow industry best practices and security standards
- Flexibility: Use either TypeScript or JavaScript based on your preference
- Modern Stack: Uses the latest stable versions of Node.js, Express, and MongoDB
- Docker Integration: Optional containerization with Docker and Docker Compose
- Complete Authentication: JWT authentication system ready to use
- Active Maintenance: Regular updates and security patches
| Feature | Tin | Express Generator | Create React App |
|---|---|---|---|
| TypeScript Support | β | β | β |
| JWT Authentication | β | β | β |
| Cookie-based Auth | β | β | β |
| MongoDB Integration | β | β | β |
| Swagger UI / API Docs | β | β | β |
| Dark Mode UI | β | β | β |
| Docker Support | β | β | β |
| Interactive CLI | β | β | β |
| Git Integration | β | β | β |
