Set default portal port to 8081, fix Dart build issue in cart screen, and update setup documentation. Co-Authored-By: Oz <oz-agent@warp.dev>
82 lines
2.3 KiB
Markdown
82 lines
2.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`
|
|
|
|
## 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.
|