react-ts-mern-template
v1.0.2
Published
MERN app template with TypeScript
Downloads
12
Maintainers
Readme
Quickstart
$ npx react-ts-mern-template <your-app-name>
Project Starter 🚀
MERN app template + Vite + TypeScript + Testing Library, with ESLint and Prettier configs, and a RESTful API with full CRUD functionality for a user database.
This template is designed for anyone wanting to build a full stack web application and immediately focus on writing the code, rather than spending time creating folders, files, configs and databases. All packages needed are included in the package.json files and can be installed with one command from the top level (see further below).
Info 🤓
Template includes:
- React with TS & Vite configuration
- ESLint and Prettier (airbnb)
- Concurrently npm package
- React Router
- Template frontend file structure
- Template CSS file structure with generic variables (not setup with a library in mind)
- Template server file structure with example Rest API for a user database
- JWT, bcrypt, CORS and auth middleware
- .env template file which includes the variables you need to fill in with your info
- React testing library, vitest + MSW
- Module aliases for client and server folders
Note: you will need to create a MongoDB database collection, and input info into the .env file provided.
Clone Repo 😎😎
Navigate to where you want to store the repo, then npm install all node modules
$ git clone https://github.com/pipelineSoftwareTeam/react-ts-mern-template.git
$ cd mern-app-template
$ npm run setup
Spinning up project 🚗
Client (individually):
$ npm run dev
Server (individually):
$ npm run dev
or using Concurrently...
From top level of project:
$ npm run dev
From server folder:
$ npm run serve
API endpoints
| Functionality | Route | HTTP Method | Protected? | | -------------------- | ---------------------- | ----------- | ---------- | | Get users | /api/auth | GET | Y | | Login user | /api/auth/login | POST | N | | Register user | /api/auth/register | POST | N | | Update user | /api/auth/:id | PUT | Y | | Update user password | /api/auth/password/:id | PUT | Y | | Delete user | /api/auth/:id | DELETE | Y |
Any protected routes require a JWT bearer token in the HTTP request header.
Romeo done! Happy coding 💪🏻
Please send a PR for any suggestions for improvement to this template 😃