@dharun_r/create-fullstack-app
v2.0.1
Published
CLI tool to scaffold React + Express + MongoDB full-stack projects with JWT authentication
Maintainers
Readme
@dharun_r/create-fullstack-app
A modern CLI tool to instantly scaffold full-stack React + Express + MongoDB applications with JWT authentication, best practices, and modern tooling.
Features
- Quick setup of full-stack applications
- React frontend with Vite and Tailwind CSS
- Express.js backend with MongoDB integration
- JWT-based authentication system
- Pre-styled authentication pages
- Pre-configured environment variables
- Development and production configurations
- Testing setup with Jest
- ESLint + Prettier configured
Quick Start
# Using npx (recommended)
npx @dharun_r/create-fullstack-app my-app
# OR using npm
npm init @dharun_r/create-fullstack-app my-app
cd my-app
npm run install:deps # Install dependencies for both frontend and backend
npm run dev # Start development serversVisit:
- Frontend: http://localhost:5173
- Backend API: http://localhost:3000
Project Structure
my-app/
├── frontend/ # React frontend (Vite)
│ ├── src/
│ │ ├── pages/ # Pre-built auth pages
│ │ │ ├── Home.jsx
│ │ │ ├── Login.jsx
│ │ │ └── Register.jsx
│ │ ├── App.jsx # Root component
│ │ └── main.jsx # Entry point
│ ├── .env # Frontend environment variables
│ └── package.json
├── backend/ # Express backend
│ ├── src/
│ │ ├── controllers/ # Route controllers
│ │ ├── middleware/ # Auth middleware
│ │ ├── models/ # MongoDB models
│ │ ├── routes/ # API routes
│ │ └── index.js # Server entry
│ ├── .env # Backend environment variables
│ └── package.json
└── package.json # Root package.jsonRequirements
- Node.js >= 16.0.0
- MongoDB (local or remote)
Getting Started
Create your project:
npx @dharun_r/create-fullstack-app my-appInstall dependencies:
cd my-app npm run install:depsSet up MongoDB:
- Start your MongoDB server
- Update connection string in
backend/.env
Start development servers:
npm run devCreate a test user:
- Navigate to http://localhost:5173/register
- Register with email and password
- You will be automatically logged in
Environment Variables
Backend (.env)
PORT=3000
MONGODB_URI=mongodb://localhost:27017/your-database
JWT_SECRET=your-secret-keyFrontend (.env)
VITE_API_URL=http://localhost:3000Available Scripts
In the root directory:
npm run install:deps- Install dependencies for both frontend and backendnpm run dev- Start both frontend and backend in developmentnpm run dev:frontend- Start only frontendnpm run dev:backend- Start only backendnpm run build- Build for productionnpm start- Start production server
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Built With
- React - Frontend library
- Vite - Frontend build tool
- Tailwind CSS - CSS framework
- Express.js - Backend framework
- MongoDB - Database
- JWT - Authentication
