Add deployment verification, redeploy steps, and repository clone/push instructions to README. Co-Authored-By: Oz <oz-agent@warp.dev>
118 lines
3.3 KiB
Markdown
118 lines
3.3 KiB
Markdown
# Flutter E-Commerce Portal (Dockerized)
|
|
|
|
A self-contained Flutter web e-commerce portal served through Docker + Nginx.
|
|
|
|
## Features
|
|
- Flutter web e-commerce layout:
|
|
- Product grid (home)
|
|
- Product detail page
|
|
- Cart page
|
|
- Checkout skeleton page
|
|
- User profile page
|
|
- Authentication via Firebase Authentication:
|
|
- Email + password
|
|
- Google login
|
|
- GitHub login
|
|
- Dockerized build and runtime (no host Flutter SDK required)
|
|
|
|
## Prerequisites
|
|
- Ubuntu with:
|
|
- Docker Engine
|
|
- Docker Compose plugin (`docker compose`)
|
|
|
|
## Project Structure
|
|
- `lib/screens/` UI pages and auth flow
|
|
- `lib/widgets/` reusable UI widgets
|
|
- `lib/models/` domain models
|
|
- `lib/services/` auth, config, catalog, and cart logic
|
|
- `assets/config/` runtime Firebase config templates
|
|
- `Dockerfile` multi-stage Flutter web build + Nginx runtime
|
|
- `docker-compose.yml` app service orchestration
|
|
- `install_portal.sh` one-command install/run
|
|
- `uninstall_portal.sh` cleanup script
|
|
|
|
## Configure Authentication Providers
|
|
1. Create a Firebase project.
|
|
2. In Firebase Console > Authentication > Sign-in method, enable:
|
|
- Email/Password
|
|
- Google
|
|
- GitHub
|
|
3. In Firebase Console > Project settings > General, copy web app config values.
|
|
4. Create local env file:
|
|
```bash
|
|
cp .env.example .env
|
|
```
|
|
5. Edit `.env` and set:
|
|
- `FIREBASE_API_KEY`
|
|
- `FIREBASE_AUTH_DOMAIN`
|
|
- `FIREBASE_PROJECT_ID`
|
|
- `FIREBASE_STORAGE_BUCKET`
|
|
- `FIREBASE_MESSAGING_SENDER_ID`
|
|
- `FIREBASE_APP_ID`
|
|
- `FIREBASE_MEASUREMENT_ID` (optional)
|
|
6. For GitHub provider in Firebase, configure GitHub OAuth app callback URL exactly as Firebase instructs.
|
|
|
|
## Install and Run
|
|
```bash
|
|
chmod +x install_portal.sh uninstall_portal.sh
|
|
./install_portal.sh
|
|
```
|
|
|
|
The portal will be available at:
|
|
- `http://localhost:8081` (default)
|
|
- or `http://localhost:<PORTAL_PORT>` if you changed `PORTAL_PORT` in `.env`
|
|
|
|
## Deployment Process
|
|
1. Ensure configuration is set in `.env` (especially Firebase values and optional `PORTAL_PORT`).
|
|
2. Build and start the application:
|
|
```bash
|
|
./install_portal.sh
|
|
```
|
|
3. Verify deployment status:
|
|
```bash
|
|
docker ps --filter name=flutter_ecommerce_portal_web
|
|
curl -I http://localhost:8081
|
|
```
|
|
4. Open the portal in a browser at `http://localhost:8081`.
|
|
|
|
### Redeploy After Changes
|
|
```bash
|
|
./install_portal.sh
|
|
```
|
|
This command rebuilds the Flutter web image and recreates the container.
|
|
|
|
## Repository Details
|
|
- Repository (web): `https://github.com/quantumrag/flutter_ecommerce_portal`
|
|
- Repository (SSH): `git@github.com:quantumrag/flutter_ecommerce_portal.git`
|
|
- Default branch: `master`
|
|
|
|
### Clone and Push
|
|
Clone:
|
|
```bash
|
|
git clone git@github.com:quantumrag/flutter_ecommerce_portal.git
|
|
```
|
|
Push local changes:
|
|
```bash
|
|
git add .
|
|
git commit -m "<your message>"
|
|
git push origin master
|
|
```
|
|
|
|
## Uninstall / Cleanup
|
|
Interactive cleanup:
|
|
```bash
|
|
./uninstall_portal.sh
|
|
```
|
|
|
|
Non-interactive cleanup:
|
|
```bash
|
|
./uninstall_portal.sh --force
|
|
```
|
|
|
|
This removes containers, local images, networks, and volumes created by this portal's Compose project.
|
|
|
|
## Notes on Secrets
|
|
- Keep secrets and keys in `.env` only; do not hard-code in Dart files.
|
|
- `.env` is consumed by Docker Compose and injected into the runtime config file inside the container.
|
|
- For production, use a proper secret manager or CI/CD secret injection.
|