Getting Started
This guide will help you set up your development environment and start working with the TimeLock project.
Table of Contents
- Prerequisites
- Installation
- Development Workflow
- Project Structure Overview
- Available Scripts
- Development Tools
- Common Tasks
- Troubleshooting
Prerequisites
Before you begin, ensure you have the following installed:
Required Software
-
Node.js (v18.19.0 or later)
node --version # Should be 18.19.0+
-
npm (comes with Node.js)
npm --version # Should be 9.0.0+
-
Git (for version control)
git --version
Recommended Tools
- Visual Studio Code - Excellent TypeScript and Angular support
- Angular Language Service - VS Code extension for Angular
- Angular DevTools - Browser extension for debugging
Browser Requirements
- Chrome/Edge (recommended for development)
- Firefox (supported)
- Safari (supported)
Installation
1. Clone the Repository
git clone <repository-url>
cd timelock
2. Install Dependencies
npm install
This will install:
- Angular framework and CLI
- TypeScript compiler
- Development dependencies
- Testing frameworks (Karma, Playwright)
3. Verify Installation
npm run ng version
You should see output similar to:
Angular CLI: 20.1.5
Node: 18.19.0
Package Manager: npm 9.8.1
OS: darwin x64
Angular: 20.1.0
... @angular/cli 20.1.5
... @angular/common 20.1.0
... @angular/compiler 20.1.0
... @angular/core 20.1.0
Development Workflow
1. Start Development Server
npm start
# or
ng serve
- Opens browser to
http://localhost:4200
- Automatically reloads on file changes
- Shows compilation errors in console and browser
2. Basic Development Cycle
- Make changes to TypeScript/HTML/CSS files
- Save files - Angular CLI automatically recompiles
- Check browser - Changes appear automatically
- Fix errors - Check console for TypeScript/compilation errors
- Test functionality - Verify your changes work as expected
3. Code Quality Checks
# TypeScript compilation check
npm run build
# Run tests
npm test
# End-to-end tests
npm run e2e
Project Structure Overview
timelock/
├── src/ # Source code
│ ├── app/ # Angular application
│ │ ├── components/ # Reusable components
│ │ ├── pages/ # Route components (views)
│ │ ├── services/ # Business logic and data
│ │ ├── models/ # TypeScript interfaces
│ │ ├── app.ts # Root component
│ │ ├── app.config.ts # App configuration
│ │ └── app.routes.ts # Route definitions
│ ├── assets/ # Static files (images, icons)
│ ├── styles.css # Global styles
│ ├── index.html # Main HTML file
│ └── main.ts # Application bootstrap
├── public/ # Public assets
├── e2e/ # End-to-end tests
├── documentation/ # This documentation
├── angular.json # Angular CLI configuration
├── package.json # Dependencies and scripts
├── tsconfig.json # TypeScript configuration
└── README.md # Basic project info
Key Directories Explained
src/app/components/
- Reusable UI components
todo-item/
- Individual task displaytodo-form/
- Task creation/editing formtodo-filters/
- Filter controls- Dialog components for various features
src/app/pages/
- Route-level components (pages)
projects/
- Project list viewproject-detail/
- Individual project viewcalendar/
- Calendar viewtimetable/
- Time planning viewupcoming/
- Upcoming tasks viewsearch/
- Search functionality
src/app/services/
- Business logic and data management
todo.service.ts
- Task managementproject.service.ts
- Project managementindexeddb.service.ts
- Data persistencetags.service.ts
- Tag management
src/app/models/
- TypeScript type definitions
todo.model.ts
- Task-related typesproject.model.ts
- Project-related types
Available Scripts
Development Scripts
# Start development server
npm start
npm run ng serve
# Build for production
npm run build
# Build and watch for changes
npm run watch
Testing Scripts
# Run unit tests
npm test
npm run ng test
# Run e2e tests
npm run e2e
# Run tests with coverage
npm run ng test --code-coverage
Angular CLI Commands
# Generate new component
npm run ng generate component my-component
# Generate new service
npm run ng generate service my-service
# Generate new interface
npm run ng generate interface my-interface
# See all available generators
npm run ng generate --help
Development Tools
Angular DevTools
-
Install the browser extension:
-
Open browser DevTools (F12)
-
Look for "Angular" tab
-
Explore component tree, signals, and performance
VS Code Extensions
Install these recommended extensions:
{
"recommendations": [
"angular.ng-template", // Angular Language Service
"ms-vscode.vscode-typescript-next", // TypeScript support
"bradlc.vscode-tailwindcss", // CSS IntelliSense
"esbenp.prettier-vscode", // Code formatting
"ms-playwright.playwright" // E2E testing support
]
}
Browser Developer Tools
Console Commands (in browser console):
// Access Angular component
ng.getComponent($0) // $0 = selected element
// Get component context
ng.getContext($0)
// Trigger change detection
ng.applyChanges($0)
Common Tasks
Adding a New Component
# Generate component
npm run ng generate component components/my-component
# This creates:
# - my-component.component.ts
# - my-component.component.html
# - my-component.component.css
# - my-component.component.spec.ts
Adding a New Service
# Generate service
npm run ng generate service services/my-service
# This creates:
# - my-service.service.ts
# - my-service.service.spec.ts
Adding a New Route
- Create the component:
npm run ng generate component pages/my-page
- Add route to
src/app/app.routes.ts
:
{
path: 'my-page',
loadComponent: () => import('./pages/my-page/my-page.component')
.then(m => m.MyPageComponent)
}
- Add navigation link in
src/app/app.ts
:
<a routerLink="/my-page" routerLinkActive="active">My Page</a>
Working with Signals
// In a service
private dataSignal = signal<Data[]>([]);
public data = this.dataSignal.asReadonly();
// In a component
export class MyComponent {
private myService = inject(MyService);
data = this.myService.data; // Reactive data
// Local component state
isLoading = signal(false);
// Computed values
dataCount = computed(() => this.data().length);
}
Adding Dependencies
# Add Angular Material
npm install @angular/material @angular/cdk
# Add a utility library
npm install lodash
npm install @types/lodash --save-dev
# Add to component imports
imports: [CommonModule, MatButtonModule]
Troubleshooting
Common Issues
1. Port 4200 already in use
# Kill process using port 4200
npx kill-port 4200
# Or use different port
ng serve --port 4201
2. Node modules issues
# Clear npm cache
npm cache clean --force
# Delete node_modules and reinstall
rm -rf node_modules package-lock.json
npm install
3. TypeScript compilation errors
# Check TypeScript version
npm list typescript
# Restart TypeScript service in VS Code
Ctrl+Shift+P > "TypeScript: Restart TS Server"
4. Angular CLI not found
# Install Angular CLI globally
npm install -g @angular/cli
# Or use npx
npx ng serve
Performance Issues
1. Slow compilation
- Close unnecessary browser tabs
- Disable browser extensions temporarily
- Increase Node.js memory:
node --max-old-space-size=8192
2. Browser memory issues
- Clear browser cache
- Close DevTools when not needed
- Restart browser periodically
Getting Help
1. Check the console
- Browser DevTools Console (F12)
- Terminal where
ng serve
is running
2. Angular documentation
3. Community resources
Next Steps
Now that you have the development environment set up:
- Explore the code - Start with Code Structure
- Make your first change - Follow Development Guide
- Understand the features - Read Features Overview
Recommended Learning Path
- Run the application -
npm start
and explore the UI - Open DevTools - Inspect components and signals
- Make a small change - Edit a component template
- Add a new feature - Follow the development guide
- Write tests - Learn the testing patterns
Happy coding! 🚀