This project is a home automation system built with Node.js (Express) for the backend, Angular for the frontend, and shared TypeScript models.
The project is divided into three main directories:
home-automation-backend
: Contains the Express backend serverhome-automation-frontend
: Contains the Angular frontend applicationshared-models
: Contains shared TypeScript models used by both the frontend and backend
The backend server is built using Express and follows a modular structure. It includes the following directories and files:
dist
: The compiled JavaScript code from the TypeScript source filessrc
: The source code for the backend applicationswagger
: Contains the generated Swagger documentation and OpenAPI specificationtypes
: Contains custom type definition filesormconfig.json
: Configuration file for TypeORMtsconfig.json
: Configuration file for TypeScripttsoa.json
: Configuration file for TSOA (TypeScript OpenAPI)docker-compose.yaml
: Configuration file for Docker Compose to set up the PostgreSQL database
The frontend application is built using Angular and follows the Angular project structure. It includes the following directories and files:
src
: The source code for the frontend applicationangular.json
: Configuration file for Angular CLItsconfig.json
: Configuration file for TypeScripttsconfig.app.json
: TypeScript configuration specific to the apptsconfig.spec.json
: TypeScript configuration specific to testing
The shared-models directory contains TypeScript models used by both the frontend and backend. It includes the following directories and files:
dist
: The compiled JavaScript code from the TypeScript source filessrc
: The source code for the shared modelstsconfig.json
: Configuration file for TypeScript
Before running the project, ensure you have Node.js, npm, and Docker installed.
- Start the PostgreSQL database using Docker Compose:
cd home-automation-backend
docker-compose up -d
- Install the dependencies for the backend, frontend, and shared-models:
cd shared-models
npm install
cd ../home-automation-frontend
npm install
cd ../shared-models
npm install
- Build the shared-models package:
cd shared-models
npm run build
- Run the backend server:
cd ../home-automation-backend
npm run dev
- Run the frontend application:
cd ../home-automation-frontend
npm start
The backend server will be running on port 3000 and the frontend application on port 4200. You can now access the frontend application at http://localhost:4200/.