Admin-only Angular 20 app to manage educational topics and images with multilingual titles. Firebase is used for Auth (email/password), Firestore, and Storage.
npm installCreate the following files and replace placeholders with your Firebase Web App config values from the Firebase console (Project settings → General → Your apps → Web app → SDK setup and configuration):
src/environments/environment.development.ts(used forng serve/ development)src/environments/environment.ts(used for production builds)
This project keeps real secrets only in untracked local files. Templates provide structure; you copy them once and fill in values locally.
Files in src/environments/:
environment.template.ts– production template with placeholder tokensenvironment.development.template.ts– development template with placeholder tokensenvironment.tsandenvironment.development.ts– your local copies (ignored by Git)
Placeholders are of the form __FIREBASE_API_KEY__, __ADMIN_EMAIL__, etc.
- Generate local files from templates (copy-only, no env vars needed):
npm run env:setup- or simply run
npm start/npm run buildonce; they auto-create missing env files via copy-only
- Open the generated files and replace placeholders with your real values:
src/environments/environment.development.tssrc/environments/environment.ts
These files are .gitignored and won’t be committed.
For CI, you have two options:
- Secure file provisioning (preferred): write
src/environments/environment.ts(and dev variant if needed) from a secure store at job runtime. - Or use the generator with CI env vars:
npm run env:ci(reads values from CI env and writes the files) beforenpm run build.
The start and build scripts run the generator with --if-missing --copy-only, so they will not overwrite your local files once created.
Example structure (replace the placeholder strings):
export const environment = {
production: false, // true in environment.ts
firebase: {
apiKey: 'YOUR_API_KEY',
authDomain: 'YOUR_PROJECT_ID.firebaseapp.com',
projectId: 'YOUR_PROJECT_ID',
storageBucket: 'YOUR_PROJECT_ID.appspot.com',
messagingSenderId: 'YOUR_SENDER_ID',
appId: 'YOUR_APP_ID',
},
// The single admin account that can access the app
adminEmail: 'admin@example.com',
} as const;The app reads these values in src/app/app.config.ts during Firebase initialization.
- In Firebase Console → Build → Authentication → Sign-in method, enable Email/Password
- In Users, create the admin user with the email you plan to use
- Make sure
adminEmailin your environment files and in the rules files matches this email
To start a local development server, run:
npm startThen open your browser at http://localhost:4201/. The application will automatically reload when you modify source files.
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
ng generate component component-nameFor a complete list of available schematics (such as components, directives, or pipes), run:
ng generate --helpTo build the project run:
npm run buildBuild artifacts are stored in the dist/ directory. Production builds are optimized for performance and speed.
Before deploying, set your Firebase project ID in .firebaserc:
- Open
.firebasercand replaceYOUR_FIREBASE_PROJECT_IDwith your actual project ID (from Firebase Console → Project settings → General → Project ID).
Authenticate and verify the active account:
npm run firebase:login
npm run firebase:whoami- Development builds use Angular's
developmentconfiguration and the file replacement that loadssrc/environments/environment.development.ts. - Production builds use the default
productionconfiguration andsrc/environments/environment.ts.
Quick commands:
# Deploy to Development (builds with development config, uses environment.development.ts)
npm run deploy:dev
# Deploy to Production (builds with production config, uses environment.ts)
# Uses your default project from .firebaserc or "firebase use"
npm run deploy
# Or explicitly set the prod project on the command
npm run deploy:prod --project=YOUR_PROD_PROJECT_IDOptional: Create a temporary preview URL (great for reviews):
npm run deploy:previewThis app is intended for a single admin user. The repository includes:
firestore.rules– restricts all reads/writes to the admin emailstorage.rules– restricts uploads/deletes to the admin email and images up to 10MB (jpeg|png|webp)
Update the admin email in both rules files to match your real admin account:
// In firestore.rules and storage.rules
// Replace admin@example.com with your admin email
To deploy rules along with hosting, you can run:
npm run deploy:allTo execute unit tests with the Karma test runner, use the following command:
ng testFor end-to-end (e2e) testing, run:
ng e2eAngular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
- Angular CLI docs: https://angular.dev/tools/cli
- AngularFire docs: https://github.com/angular/angularfire