This project consists of separate directories for the backend (Node.js and MySQL) and frontend (NextJS 14).
- Node.js installed on your machine
- MySQL installed and running locally or accessible remotely
- Incase SQL is not installed, setup from here SQL Seteup
- Navigate to the
backend
directory:cd backend
- Install dependencies:
npm install
- Configure the database connection in
db/database.js
- Run the database migrations:
npm run db:migrate
- Seed data of Locations and Shops:
npm run db:seed
- Start the backend server:
npm start
Note: Undo the seeding by npm run db:seed:undo
- Node.js installed on your machine
- Navigate to the
frontend
directory:cd frontend
- Install dependencies:
npm install
- Start the frontend development server:
npm start
- Access the frontend application by navigating to
http://localhost:3000
in your web browser. And Backend server will be running athttp://localhost:8080
config
: Configuration file of Sequilize.migrations
: Database migration scripts (Currently Empty).seeders
: Seeding filesmodels
: Database models.routes
: API routes.controllers
: Request handlers.index.js
: Entry point for the backend server.
Here's an overview of the main libraries used in the package.json
for the backend:
- express: A web application framework for Node.js, providing a robust set of features for building APIs and web applications.
- body-parser: Middleware for parsing incoming request bodies in Express applications.
- cors: Middleware for enabling Cross-Origin Resource Sharing (CORS) in Express applications, allowing controlled access to resources from different origins.
- mysql2: MySQL client for Node.js, allowing the application to interact with MySQL databases.
- sequelize: An ORM (Object-Relational Mapping) library for Node.js, providing a powerful interface for interacting with SQL databases using JavaScript objects and functions.
- nodemon: Utility for automatically restarting the Node.js application when changes are detected, enhancing the development workflow by eliminating the need for manual server restarts.
- sequelize-cli: Command-line interface for Sequelize, providing commands for generating migrations, models, and seeds, as well as other database-related tasks.
public
: Public assets and HTML template.components
: Reusable React components.pages
: Individual pages or views.services
: Backend API service functions.context
: Handling Global StatesApp.js
: Main component.index.js
: Entry point for the frontend application.
Here's an overview of the main libraries used in the package.json
for the frontend:
- @emotion/react: Enables styled components with CSS-in-JS.
- @emotion/styled: Provides styled components for Emotion.
- @mui/material: Material-UI library for building UI components following Material Design guidelines.
- @tanstack/react-query: React Query library for managing asynchronous data fetching.
Note: A lot can be improved in this code but due to shortage of time, this is what I have done. Please share the feedback of any improvements you suggest. Thanks
Made By: Huzaifa