An Uber Eats style delivery platform running on Medusa 2.0 and Next.js 14.
Medusa Eats is built with:
Features include:
- Restaurant storefront
- Realtime order status dashboards
- Driver and restaurant dashboards
- User roles
- Authentication
- Medusa Workflows
- Realtime Server Sent Event
The project consists of two main directories:
/backend
contains the Medusa 2.0 project with all the customizations./frontend
contains the Next.js project.
Use Yarn to install dependencies in both directories.
In /frontend
run:
yarn
In /backend
run:
yarn
The project comes with .env.template
files to quickly set up your environment variables. Copy them to a .env
file by running the following commands:
In /frontend
run:
cp .env.template .env
In /backend
run:
cp .env.template .env
Create a Postgres database called medusa-eats
.
The repo contains a setup script to build the project, run migrations and seed dummy data.
Make sure your local Postgres server is running.
In /backend
run:
yarn setup-db
This will also create an admin user with the following credentials:
email: [email protected]
pasword: supersecret
You are now ready to start up your project.
Start Medusa dev server
Make sure that Redis and Postgres servers are running locally on their default ports.
In /backend
run:
yarn dev
The Medusa server is now running on http://localhost:9000.
Start Next.js dev server
In a separate terminal, cd to /frontend
and run:
yarn dev
The Next.js frontend is now running on http://localhost:3000.
We're gonna create a restaurant admin and driver account so we'll have access to both sides of the platform.
Create restaurant admin account
- Go to http://localhost:3000/signup.
- Select 'I'm a restaurant'.
- Select the restaurant you want to create an admin for.
- Fill out the remaining form fields and click 'Create account'.
- You can now log in as a restaurant admin and access the restaurant dashboard at http://localhost:3000/dashboard/restaurant.
Create driver account
- Repeat above steps, but this time select 'I'm a driver'.
- You can now log in as a driver and access the driver dashboard at http://localhost:3000/dashboard/driver.
To go through the entire delivery workflow in realtime, you'll need to log into both a restaurant and a driver account. To do so, use an icognito window or second browser.
- Go to the storefront at http://localhost:3000/.
- Select a restaurant from the list.
- Add menu items to you delivery by clicking the + buttons.
- Click the shopping bag button on the top right.
- Click 'Go to checkout'.
- Complete the form and place you order. A live order status dashboard will show up.
- In a new tab, go to http://localhost:3000/dashboard/restaurant and log in as an admin for the restaurant you just placed an order at.
- Your order should be visible in the "Incoming orders" column. Click the button to accept the incoming order.
- In an incognito window, go to http://localhost:3000/dashboard/driver and log in as a driver.
- The accepted order will show up on your dashboard. Click the button to claim it.
- The order will go through the different stages on all dashboards in realtime. You can progress the order by marking each stage as complete on the relevant dashboard.