Welcome to HackHeist. In this workshop, you will build a full-stack application using React, Express, and MongoDB while learning about RESTful APIs. This project simulates a heist planning system, where you can manage crew members and plan heists.
By the end of this workshop, you will:
- Understand full-stack development using MERN (MongoDB, Express, React, Node.js).
- Create a RESTful API using Express.
- Use MongoDB and Mongoose for database operations.
- Build a React frontend to interact with the backend.
- Implement CRUD operations (Create, Read, Update, Delete).
Ensure you have the following installed:
git clone https://github.com/your-username/hack-heist.git
cd hack-heist
- Navigate to the backend folder:
cd server
- Install dependencies:
npm install
- Duplicate the sample
sample.env
file, rename it to be.env
and add your MongoDB URI:DB_URL=mongodb://localhost:27017/HackHeist # Can alternatively use Mongo Atlas
- Start the backend server:
The server should now be running at
npm run dev
http://localhost:4000
.
- Navigate to the frontend folder:
cd ../client
- Install dependencies:
npm install
- Start the frontend development server:
The frontend should now be running at
npm run dev
http://localhost:3000
.
This workshop is divided into sections where we progressively build upon HackHeist.
- Create a HeistCard component in
HeistCard/index.jsx
- Define a Heist model with fields like
location
,startDate
,endDate
andplanEntry
. - Create a Mongoose schema in
models/heistModel.js
.
- Implement CRUD routes for managing heists in
pages/index.jsx
. - (Optional) Use Postman to test the API endpoints.
- Use Express routes to load data in
routes/heistRoutes.js
. - Implement fetching heists in
pages/index.jsx
.
Method | Endpoint | Description |
---|---|---|
GET | /api/crew |
Get all crew members |
POST | /api/crew |
Add a new crew member |
GET | /api/heist |
Get all heist |
POST | /api/heist |
Add a new heist |
- Implement user authentication.
- Improve UI with Tailwind CSS or Material UI.
- Deploy the application using Vercel (frontend) and Render (backend).
If you have any issues, reach out on Discord!