Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nikolap994/turborepo-react-express-boilerplate
A full-stack boilerplate using Turborepo for monorepo management, with Vite + React on the frontend, Express.js on the backend, MongoDB via Mongoose, and JWT-based authentication.
https://github.com/nikolap994/turborepo-react-express-boilerplate
expressjs jwt mongoose react turborepo vite
Last synced: 16 days ago
JSON representation
A full-stack boilerplate using Turborepo for monorepo management, with Vite + React on the frontend, Express.js on the backend, MongoDB via Mongoose, and JWT-based authentication.
- Host: GitHub
- URL: https://github.com/nikolap994/turborepo-react-express-boilerplate
- Owner: nikolap994
- License: mit
- Created: 2024-09-07T07:33:58.000Z (2 months ago)
- Default Branch: master
- Last Pushed: 2024-09-07T10:48:19.000Z (2 months ago)
- Last Synced: 2024-10-10T14:40:18.806Z (about 1 month ago)
- Topics: expressjs, jwt, mongoose, react, turborepo, vite
- Language: JavaScript
- Homepage:
- Size: 35.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Full-Stack Turborepo Boilerplate with Vite, React, Express, and MongoDB
This project is a full-stack boilerplate that uses [Turborepo](https://turbo.build/repo) for managing both frontend and backend. It includes:
- Frontend: Vite + React
- Backend: Express.js
- Authentication: JWT
- Database: MongoDB (Mongoose)
- Styling: Tailwind CSSThe project comes with a pre-configured basic `User` model, `Login` and `Register` pages, and a basic `Dashboard` for authenticated users. The backend API also includes middleware to protect routes requiring authentication.
## Getting Started
To start the project:
1. Install dependencies from the root:
```bash
npm install
```2. Run the development server:
```bash
npm run dev
```This will start both the frontend and backend at the same time. The frontend will be accessible at:
```
http://localhost:5173/
```## API Routes
All API routes are accessible under:
```
http://localhost:5173/api/
```## Environment Variables
In the `apps/backend` folder, there is a `.env` file that handles sensitive configurations such as the MongoDB connection and JWT secret key. You will need to provide the following environment variables:
```env
MONGO_URI="mongodb+srv://:@cluster0.rz1pv.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0"
JWT_SECRET="v3ryS3cure&L0ngS3cr3tKeyTh@tIsH@rdToGu3ss!"
```- `MONGO_URI`: This is the connection string for MongoDB. Replace with your own MongoDB connection URL.
- `JWT_SECRET`: This is the secret key used for signing JWT tokens. Ensure it is a long, complex string to maintain security.## TailwindCSS
Tailwind CSS is already set up and ready to use for styling.
## Installing Additional Packages
If you need to add a React package for the frontend, navigate to the frontend app directory and install it:
```bash
cd apps/frontend
npm install
```To add packages for the backend, go to the backend app directory:
```bash
cd apps/backend
npm install
```## Additional Info
- The backend API comes with JWT-based authentication and route protection middleware.
- The frontend includes a basic `Login`, `Register`, and `Dashboard` page.