UNPKG

create-tin

Version:

Scaffold a TypeScript or JavaScript Express boilerplate

116 lines (88 loc) • 2.64 kB
# Create Tin [![npm version](https://img.shields.io/npm/v/create-tin.svg)](https://www.npmjs.com/package/create-tin) [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](https://opensource.org/licenses/ISC) Fast Express.js project scaffold with TypeScript/JavaScript support, JWT authentication, and MongoDB integration. ## Features - šŸš€ **Instant setup** - Generate Express projects in seconds - šŸ”§ **TypeScript or JavaScript** - Choose your preferred language - šŸ”‘ **JWT Authentication** - Built-in auth system - šŸ—„ļø **MongoDB Ready** - Pre-configured database connection - šŸ“ **Clean Structure** - Organized project folders - ⚔ **Git Integration** - Optional repository initialization ## Quick Start ```bash npx create-tin my-project ``` ## Usage ### Interactive Mode ```bash npx create-tin my-express-app ``` ### Command Line Flags ```bash # TypeScript with git npx create-tin my-project --ts --git # JavaScript without git npx create-tin my-project --js --skip-git ``` ### Available Options - `--ts` - Use TypeScript - `--js` - Use JavaScript - `--git` - Initialize git repository - `--skip-git` - Skip git initialization ## Project Structure ### TypeScript Project ``` my-project/ ā”œā”€ā”€ src/ │ ā”œā”€ā”€ index.ts │ ā”œā”€ā”€ config/db.ts │ ā”œā”€ā”€ controllers/authController.ts │ ā”œā”€ā”€ middlewares/ │ ā”œā”€ā”€ models/userModel.ts │ ā”œā”€ā”€ routes/authRoutes.ts │ └── types/ ā”œā”€ā”€ package.json ā”œā”€ā”€ tsconfig.json ā”œā”€ā”€ .env └── README.md ``` ### JavaScript Project ``` my-project/ ā”œā”€ā”€ src/ │ ā”œā”€ā”€ index.js │ ā”œā”€ā”€ config/db.js │ ā”œā”€ā”€ controllers/authController.js │ ā”œā”€ā”€ middlewares/ │ ā”œā”€ā”€ models/userModel.js │ └── routes/authRoutes.js ā”œā”€ā”€ package.json ā”œā”€ā”€ .env └── README.md ``` ## Environment Variables Generated `.env` file: ```env MONGO=mongodb://localhost:27017/myapp PORT=5000 ``` ## Getting Started After scaffolding: ```bash cd my-project npm run dev # Start development server ``` ## API Endpoints | Method | Endpoint | Description | |--------|----------|-------------| | POST | `/api/auth/register` | User registration | | POST | `/api/auth/login` | User login | | GET | `/api/auth/profile` | Get user profile (protected) | ## Dependencies **Runtime:** - express, mongoose, jsonwebtoken, bcryptjs, cors, dotenv **TypeScript projects also include:** - typescript, @types/*, tsx, rimraf ## License ISC