8000 GitHub - arfanadam/apu-portal · GitHub
[go: up one dir, main page]

Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Central application portal with Firebase authentication.

Setup

1. Install dependencies

npm install

2. Configure Firebase

  • Copy .env.example to .env
  • Add your Firebase config values

3. Start the dev server

npm run dev

Local dev runs on http://localhost:4321 with native file events for fastest reload.


Docker Setup

Files Created

  • docker-compose.yml — Defines dev and prod services
  • Dockerfile.dev — Lightweight Node container for development

Files Modified

  • Dockerfile — Added build args for Firebase PUBLIC_* env vars (required because .env is in .dockerignore)

How to Use

# Local development with hot reload
docker compose up dev
# → http://localhost:4322 (for external viewers/testers)

# Production build & serve
docker compose up prod
# → http://localhost:80

# Stop a service
docker compose down dev
docker compose down prod

# Rebuild after dependency changes
docker compose build dev

# View logs
docker compose logs dev

Key Design Decisions

Concern Decision
Hot reload Project directory mounted as volume; Astro's Vite dev server watches for changes via polling
node_modules isolation Anonymous volume (/app/node_modules) prevents host node_modules from overwriting container's
Env vars in production Passed as Docker build args (not via .env file) to keep secrets out of the image
Git workflow Unchanged — git operations happen on the host; .git is excluded from Docker build
Port conflicts Dev on 4321 (local), 4322 (Docker), prod on 80

Workflow

Local Dev (primary)

npm install
npx astro dev --background
  • Port: 4321
  • Fastest reload, native file events
  • Accessible only on local machine

Docker Dev (for testers/viewers)

docker compose up dev
  • Port: 4322 (mapped to container's 4321)
  • Externally accessible via network IP
  • Changes auto-refresh via polling
  • No setup needed for testers

Hot Reload on Windows Docker

Astro's Vite file watcher didn't detect changes through Docker volume mounts on Windows. Fixed by enabling polling in astro.config.mjs (server.watch.usePolling: true).


Housekeeping (10 July 2026)

Removed redundant/generated files:

Item Reason
firebaseid.md Redundant — Firebase config already in .env
dist/ Build artifact — gitignored, regeneratable
.astro/ Astro cache — gitignored, auto-generated
node_modules/ Host deps — optional when using Docker

Deployment

Firebase (Before deploying)

Add your domain to Firebase Console → Authentication → Settings → Authorized domains:

  • apu.zarda.my

Security Headers (Configure at CDN / reverse proxy)

Recommended Content-Security-Policy:

default-src 'self';
script-src 'self' 'unsafe-inline' https://apis.google.com;
style-src 'self' 'unsafe-inline';
connect-src 'self' https://*.googleapis.com https://*.firebaseio.com https://identitytoolkit.googleapis.com;
frame-src https://*.firebaseapp.com;
img-src 'self' https://*.googleapis.com https://*.gstatic.com data:;
font-src 'self' https://fonts.gstatic.com;

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0