A simple, minimalist full-stack web application built using the MERN stack (MongoDB, Express.js, React.js, Node.js). This project allows users to register for an event, storing the data securely in a local MongoDB database.
- Frontend: React.js, functional components, Hooks (useState, fetch API), simple CSS
- Backend: Node.js, Express.js
- Database: Local MongoDB (
mongodb://127.0.0.1:27017/eventDB)
event-registration/
├── backend/
│ ├── server.js # Express server entry point
│ ├── models/
│ │ └── Registration.js # Mongoose schema
│ ├── routes/
│ │ └── registerRoute.js # API route handler
│ └── package.json
│
├── frontend/
│ ├── src/
│ │ ├── App.js # Main React component
│ │ ├── index.js # React root
│ │ └── index.css # Minimal styles
│ ├── public/
│ │ └── index.html
│ └── package.json
Make sure you have Node.js and a local instance of MongoDB installed and running.
- Open a terminal and navigate to the
backendfolder. - Install dependencies:
(This installs
npm install
express,mongoose, andcors) - Start the backend server:
or for development mode (auto-restart):
npm start
Expected output:npm run dev
✅ Connected to MongoDB (eventDB) 🚀 Server running at http://localhost:5000
- Open a new terminal and navigate to the
frontendfolder. - Install dependencies:
(This installs React, ReactDOM, and React Scripts)
npm install
- Start the React development server:
The application will automatically open in your browser at
npm start
http://localhost:3000.
- The frontend (
App.js) captures the user's Full Name, Email, Phone, and Event Name. - On submit, it sends a
POSTrequest tohttp://localhost:5000/registerusing thefetchAPI. - The backend (
registerRoute.js) validates the incoming data. - If valid, it saves the data into the local MongoDB instance using the Mongoose model (
Registration.js). - A success response is sent back to the frontend, which clears the form and shows a success message.
- Database Name:
eventDB - Collection Name:
registrations - Connection String:
mongodb://127.0.0.1:27017/eventDB