Features β’ Installation β’ Usage β’ Technologies β’ Architecture
Complete employee management system (CRUD) with advanced Firebase authentication, built with the latest versions of Angular and following modern development best practices.
The application features:
- π Multiple authentication methods: Email/Password and Google OAuth
- π€ Complete user management: Registration, login, profile, and password recovery
- πΌ Full CRUD operations for employee management
- π¨ Modern, responsive UI with Bootstrap 5
- π Enterprise-grade security with JWT tokens and route guards
- β Firebase Auth authentication
- β User Registration with email validation
- β Email/Password Login with error handling
- β Google Sign-In (OAuth 2.0)
- β Forgot Password with email recovery
- β Email Verification system
- β User Profile page with account details
- β Securely stored JWT tokens
- β Route protection with Guards
- β Input validation on all forms
- β Environment variables for sensitive credentials
- β Create new employees
- β List all employees
- β Update employee information
- β Delete employees
- β Required field validation
- β Responsive interface with Bootstrap 5
- β Responsive, mobile-first design
- β
Modern template syntax (
@if,@for) - β Loading spinners for async operations
- β User-friendly error messages with dismissible alerts
- β Success notifications for completed actions
- β Intuitive navigation with Angular Router
- β Visual feedback for CRUD operations
- β Bootstrap 5 cards and modern components
- β Modular and reusable services
- β Professional observable handling (no memory leaks)
- β Structured logging system
- β TypeScript typed interfaces
- β Separation of Concerns (SoC)
| Technology | Version | Usage |
|---|---|---|
| Angular | 19.2.17 | Main framework |
| TypeScript | 5.8.3 | Programming language |
| RxJS | 7.8.2 | Reactive programming |
| Bootstrap | 5.3.8 | CSS framework |
| Technology | Version | Usage |
|---|---|---|
| Firebase | 12.6.0 | Realtime database |
| Firebase Auth | - | User authentication |
- Angular CLI 19.2.19
- Karma (Testing)
- Jasmine (Unit Testing)
CRUD/
βββ src/
β βββ app/
β β βββ actualiza-componente/ # Update component
β β βββ caracteristica-emp/ # Employee features
β β βββ contacto-comp/ # Contact page
β β βββ error-personalizado/ # 404 page
β β βββ forgot-password/ # π Password recovery
β β β βββ forgot-password.component.ts
β β β βββ forgot-password.component.html
β β β βββ forgot-password.component.css
β β βββ home-component/ # Main page (list)
β β βββ login/ # Authentication system
β β β βββ login.component.ts
β β β βββ login.service.ts # Auth + Google Sign-In
β β β βββ login-guardian.ts # Route Guard
β β βββ register/ # π User registration
β β β βββ register.component.ts
β β β βββ register.component.html
β β β βββ register.component.css
β β βββ user-profile/ # π User profile page
β β β βββ user-profile.component.ts
β β β βββ user-profile.component.html
β β β βββ user-profile.component.css
β β βββ paren-c/ # Employee component
β β βββ proyectos-comp/ # Projects page
β β βββ quienes-somos-comp/ # About us page
β β βββ shared/ # Shared services
β β β βββ loading-spinner/ # π Reusable spinner
β β β βββ firebase-response.interface.ts
β β β βββ logger.service.ts
β β β βββ notification.service.ts
β β βββ app.component.ts # Root component
β β βββ app.module.ts # Main module
β β βββ data.services.ts # Firebase data service
β β βββ empleado.model.ts # Employee model
β β βββ empleados.service.ts # Business logic
β βββ environments/ # Environment variables
β β βββ environment.ts # Production
β β βββ environment.development.ts # Development
β β βββ environment.example.ts # Template for setup
β βββ assets/ # Static resources
β βββ main.ts # π₯ Firebase initialization
β βββ index.html
βββ angular.json # Angular configuration
βββ package.json # Dependencies
βββ README.md
Make sure you have installed:
- Node.js (version 18.x or higher)
- npm (version 9.x or higher)
- Angular CLI 19.x
npm install -g @angular/cli@19- Clone the repository
git clone <repository-url>
cd CRUD- Install dependencies
npm install- Configure Firebase
Create a project in Firebase Console and get your credentials.
Edit src/environments/environment.development.ts:
export const environment = {
production: false,
firebase: {
apiKey: "YOUR_API_KEY",
authDomain: "your-project.firebaseapp.com",
projectId: "your-project",
databaseURL: "https://your-project-default-rtdb.firebaseio.com"
}
};
β οΈ IMPORTANT: Never upload your Firebase credentials to public repositories. Addsrc/environments/to your.gitignore.
- Enable Firebase Authentication Providers
In the Firebase Console:
- Go to Authentication β Sign-in method
- Enable Email/Password provider
- Enable Google provider:
- Add your support email
- Add your project's public-facing name
- Save changes
- Start the development server
ng serveNavigate to http://localhost:4200/
npm start
# or
ng serveThe application will automatically reload when you make changes to the files.
| Route | Description | Protected |
|---|---|---|
/ |
Home - Employee list | β No |
/login |
User login (Email/Password or Google) | β No |
/register |
New user registration | β No |
/forgot-password |
Password recovery | β No |
/profile |
User profile and account settings | β Yes |
/quienes |
About us page | β Yes |
/contacto |
Contact page | β Yes |
/proyectos |
Projects page | β No |
/actualiza/:id |
Update employee | β No |
- Navigate to
/register - Enter email and password (min 6 characters)
- Confirm password
- Click "Register"
- Automatically logged in and redirected to home
- Navigate to
/login - Enter your credentials
- Click "Login"
- Redirected to home page
- Navigate to
/login - Click "Sign in with Google" button
- Select your Google account
- Automatically redirected back and logged in
- Click "Forgot password?" link on login page
- Enter your email address
- Click "Send Reset Link"
- Check your email for password reset instructions
- After logging in, click "Profile" in navigation
- View your account details:
- Email address
- Email verification status
- Account creation date
- Last sign-in time
- Send verification email if not verified
- Logout from your account
npm run build
# or
ng buildBuild artifacts will be stored in the dist/crud-app directory.
This project is ready for Vercel deployment with automatic environment configuration.
Quick Deploy:
- Push your code to GitHub
- Import project to Vercel
- Add environment variables in Vercel dashboard:
FIREBASE_API_KEYFIREBASE_AUTH_DOMAINFIREBASE_PROJECT_IDFIREBASE_DATABASE_URLFIREBASE_STORAGE_BUCKETFIREBASE_MESSAGING_SENDER_IDFIREBASE_APP_ID
- Deploy!
π Full deployment guide: See VERCEL_SETUP.md for detailed instructions.
The build script automatically generates environment files from Vercel environment variables during deployment.
# Unit tests
npm test
# Tests with coverage
ng test --code-coverage| Command | Description |
|---|---|
npm start |
Start development server |
npm run build |
Build the application for production |
npm test |
Run unit tests |
npm run watch |
Build in watch mode (development) |
The application follows the MVC (Model-View-Controller) pattern adapted for Angular:
- Model:
empleado.model.ts, interfaces inshared/ - View: HTML Templates + CSS
- Controller: TypeScript Components
βββββββββββββββ ββββββββββββββββ βββββββββββββββ
β Component β βββ> β Service β βββ> β Firebase β
β (View) β <βββ β (Logic) β <βββ β (Backend) β
βββββββββββββββ ββββββββββββββββ βββββββββββββββ
Handles business logic for CRUD operations.
Communicates with Firebase Realtime Database.
Advanced authentication manager with:
- User registration (
register()) - Email/password login (
login()) - Google OAuth Sign-In (
loginWithGoogle()) - Password recovery (
resetPassword()) - Redirect handling (
handleRedirectResult()) - Session management with JWT tokens
- Auth state listener for automatic token refresh
Conditional logging system (development vs production).
User notification system.
β
Environment Variables: Firebase credentials separated from code
β
JWT Authentication: Tokens stored in localStorage
β
Authorization Headers: Tokens sent in HTTP headers
β
Route Guards: Private route protection
β
Input Validation: Injection prevention
β
Strong Typing: TypeScript to prevent errors
Make sure to configure security rules in Firebase:
{
"rules": {
".read": "auth != null",
".write": "auth != null"
}
}Global styles are in:
src/styles.css- Global styles- Each component has its own CSS file
You can customize Bootstrap colors by editing variables in src/styles.css:
:root {
--bs-primary: #your-color;
--bs-secondary: #your-color;
}Solution: Make sure you're using the correct Firebase version:
npm install [email protected]Solution: Reinstall dependencies:
rm -rf node_modules package-lock.json
npm installSolution: Verify that the Firebase URL in environment.ts is correct and that security rules allow access.
Solution: This happens when Firebase isn't initialized before Angular starts. The app already handles this by initializing Firebase in main.ts before bootstrapping Angular.
Solution:
- Go to Firebase Console
- Navigate to Authentication β Sign-in method
- Enable the Google provider
- Add your support email
- Save changes
Solution: The app uses signInWithRedirect instead of signInWithPopup to avoid COOP issues. This is already implemented.
Solution: The app uses onAuthStateChanged listener to automatically refresh tokens. Make sure you're on the latest version of the code.
This version includes major authentication enhancements:
- β¨ User Registration - Complete signup flow with validation
- β¨ Forgot Password - Email-based password recovery
- β¨ User Profile - Account details and email verification
- β¨ Loading Spinner - Reusable component for async operations
- π Google Sign-In - OAuth 2.0 authentication with redirect flow
- π§ Email Verification - Send verification emails from profile page
- π Auto Token Refresh - Auth state listener keeps tokens updated
β οΈ Enhanced Error Handling - User-friendly error messages- π¨ Modern UI Updates - Bootstrap 5 cards, alerts, and icons
- π Firebase initialization moved to
main.tsfor better reliability - π§ Changed from
signInWithPopuptosignInWithRedirectto avoid COOP issues - π‘οΈ Automatic JWT token management with
onAuthStateChanged - π± Fully responsive authentication pages
- β»οΈ Reusable loading spinner component across the app
- Angular Documentation
- Firebase Documentation
- Firebase Authentication
- Bootstrap 5 Documentation
- RxJS Documentation
Contributions are welcome! Please:
- Fork the project
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
See CONTRIBUTING.md for detailed guidelines.
This project is licensed under the MIT License. See the LICENSE file for details.
Norman - GitHub