Zipkart Zipkart Docs v1.0.0
Step 5 · Websites & Hosting

Deploy the Websites

Upload the three websites to Firebase Hosting (free SSL, recommended) or to any server or cPanel host.

20 min

Pick one way. Both host all three websites.

Fast, free SSL, and in the same Firebase project. One project can hold one site per website.

1. Sign in and choose the project (in the Zipkart folder):

npm install -g firebase-tools
firebase login
firebase use --add

2. Create two more sites. The project already has one named after the project ID. Site names are unique across Firebase, so add your own word:

firebase hosting:sites:create yourshop-admin
firebase hosting:sites:create yourshop-store

3. Link each site to a name:

firebase target:apply hosting admin yourshop-admin
firebase target:apply hosting store yourshop-store
firebase target:apply hosting customer your-project-id

4. Create firebase.json in the Zipkart folder:

firebase.json
{
  "hosting": [
    { "target": "admin",    "public": "admin/build/web",    "rewrites": [{ "source": "**", "destination": "/index.html" }] },
    { "target": "store",    "public": "store/build/web",    "rewrites": [{ "source": "**", "destination": "/index.html" }] },
    { "target": "customer", "public": "customer/build/web", "rewrites": [{ "source": "**", "destination": "/index.html" }] }
  ]
}

5. Build and deploy:

cd admin && flutter build web --release && cd ..
cd store && flutter build web --release && cd ..
cd customer && flutter build web --release && cd ..
firebase deploy --only hosting

To update one site: firebase deploy --only hosting:admin.

✔  hosting[yourshop-admin]: release complete
✔  Deploy complete!
Hosting URL: https://yourshop-admin.web.app

1. Upload. Give each website its own subdomain. Delete the old files first, then upload everything inside build/web/ (not the folder itself) to that site's document root, with FTP, the cPanel File Manager or SSH. Include the hidden .htaccess file.

2. Apache or cPanel: nothing to add. Each build already contains a .htaccess file. It opens clean addresses such as /orders on refresh, returns a real 404 for a missing script, and makes browsers check for a new version of the app's files on every visit. If your FTP program hides dot-files, turn on "show hidden files" so it is uploaded.

3. Clear the hosting cache after every upload. If your host has a CDN or cache (Hostinger, Cloudflare, LiteSpeed…), purge it after each upload, then open the site with Ctrl + Shift + R. Otherwise visitors can get an old main.dart.js with the new page files, and a page shows Could not open this page.

Nginx: inside the site's server { } block:

root /var/www/yourshop-admin;
index index.html;
location / {
  try_files $uri $uri/ /index.html;
}
location ~* \.(js|mjs|wasm|json)$ {
  try_files $uri =404;
  add_header Cache-Control "no-cache, must-revalidate";
}

Hosting in a sub-folder

A subdomain is easiest. For yourdomain.com/admin/, build with flutter build web --release --base-href /admin/ and point the rewrite rule to /admin/index.html.

Next

Connect your own domains and turn on HTTPS: Domains & SSL.