Public template for building an online menu and ordering app for restaurants.
- View dishes on the menu.
- Order dishes with their extra options.
- View order history.
- View restaurant information.
- Follow the restaurant's OA.
Demo | Entrypoint |
---|---|
- Install Visual Studio Code and Zalo Mini App Extension.
- Click on Create Project > Choose ZaUI Menu template > Wait until the generated project is ready.
- Configure App ID and Install Dependencies, then navigate to the Run panel > Start to develop your Mini App 🚀
- Install Node JS.
- Install Zalo Mini App CLI.
- Download or clone this repository.
- Install dependencies:
npm install
- Start the dev server using
zmp-cli
:zmp start
- Open
localhost:3000
in your browser and start coding 🔥
This template is built using Vite 5.x, which is not compatible with Zalo Mini App Studio.
-
Create a mini program. For instructions on how to create a mini program, please refer to the Coffee Shop Tutorial
-
Deploy your mini program to Zalo using the mini app ID created.
If you’re using Zalo Mini App Extension: navigate to the Deploy panel > Login > Deploy.
If you’re using
zmp-cli
:zmp login zmp deploy
-
Scan the QR code using Zalo to preview your mini program.
The repository contains sample UI components for building your application. You may integrate your APIs to fetch menu items, order history, OA info, and process orders. You may also modify the code to suit your business needs.
Folder structure:
-
src
: Contains all the logic source code of your Mini App. Inside thesrc
folder:components
: Reusable components written in React.js.constants
: Configurations for the Mini App, such as API endpoints and routing.css
: Stylesheets; pre-processors are also supported.hooks
: Custom utility hooks.mock
: Example data as json files.modules
: Each module contains a set of components, hooks, and state management for a specific feature:merchants
: Display merchant information and layout the menu.oa
: Follow OA.orders
: Cart management and order history.products
: Product-related features.
pages
: A Page is also a component but will act as an entire view and must be registered insideapp.tsx
as a Route.utils
: Reusable utility functions, such as API integration, storage management, date and time formatting, etc.app.tsx
: Root component of your entire Mini App. React DOM will mount this component to the element#app
.main.ts
: Entry point of your Mini App.polyfills.ts
: Polyfills for older browsers.shared.d.ts
: Contains TypeScript declarations for third-party modules and global objects.
-
app-config.json
: Zalo Mini App Configuration.
The other files (such as tailwind.config.js
, vite.config.mts
, tsconfig.json
, postcss.config.js
, .eslintrc.js
, and .prettierrc
) are configurations for libraries used in your application. Visit the library's documentation to learn how to use them.
- In
.env.development
and.env.production
, setVITE_API_URL
to your server URL. - Your server should implement the following APIs:
GET /
: Retrieve your merchant's information.GET /menu-items
: Retrieve items (dishes and their topping options) to be displayed on the menu.GET /oa
: Retrieve your OA information and the followed status, based on the user's identity.GET /orders
: Retrieve order history, based on the user's identity.GET /sessions
: Retrieve the current session, based on the user's identity.POST /orders
: Process submitted orders.
The user's identity can be retrieved from the
Authorization: Bearer ${ACCESS_TOKEN}
header sent along with each API request. Visit the Login with Zalo documentation for more detailed instructions.
Refer to the
src/mock/*.json
files for sample data and structure.
Copyright (c) Zalo Group and its affiliates. All rights reserved.
The examples provided by Zalo Group are for non-commercial testing and evaluation purposes only. Zalo Group reserves all rights not expressly granted.