-
-
Notifications
You must be signed in to change notification settings - Fork 21
Guide for New Developers
WIP!! Everything below was generated by a custom chatgpt Ariel created: https://chatgpt.com/g/g-bMEXH2CLV-home-unite-us-pro
- Introduction
- Project Structure
- Setting Up Your Development Environment
- Understanding the Codebase
- Key Technologies and Dependencies
- Working with Git and GitHub
- Best Practices for Contributing
- Common Commands
- FAQ
Welcome to the Home Unite Us codebase! This guide will help you navigate the codebase, understand the key parts, and set up your environment for contributing to the project.
If you have any questions or need help, please feel free to reach out via the #home-unite-us-dev Slack channel.
Here is an overview of the key directories and files in the project:
HomeUniteUs/
│
├── /app/ # Frontend code (React)
├── /api/ # Backend code (Python/Flask, started converting to FastAPI Sept 2024)
├── /scripts/ # Utility scripts for deployment or development
├── README.md # Project overview and setup instructions
└── docker-compose.yml # Docker configuration for local development
- /app/: Contains the frontend code, built with React.
- /api/: Houses the backend code, a REST API built using Python and Flask, with Connexion for API routing.
- /scripts/: Utility scripts for various tasks such as deployment and automation.
- /docker-compose.yml: Manages multi-container Docker applications for local development.
To get started with the project, follow these steps:
-
Clone the repository:
git clone https://github.com/hackforla/HomeUniteUs.git
-
Install dependencies: Navigate to both the
/app
and/api
directories and run the following command in each:npm install # For the frontend (app) pip install -r requirements.txt # For the backend (api)
-
Set up environment variables: Copy the
.env.example
file in both the/app
and/api
directories to a.env
file and update any necessary credentials or settings by contacting a team member for the required values. -
Start the development servers:
- Using Docker (recommended):
The frontend should be available at
docker-compose up
http://localhost:4040
and the backend API athttp://localhost:8080
.
- Using Docker (recommended):
-
Access the app:
- Frontend: Runs on
http://localhost:4040
- Backend: API runs on
http://localhost:8080
- Frontend: Runs on
- The frontend is built with React and communicates with the backend API for data.
- Main entry point:
/app/src/index.tsx
- Components are organized in
/app/src/components/
. - We use Redux for state management and Material UI for styling and UI components.
- The backend is a REST API built using Flask and connexion for routing and validation.
- Main entry point:
/api/app.py
- Routes and OpenAPI specifications are defined in
/api/routes/
and/api/spec/
. - We use SQLAlchemy as the Object-Relational Mapper (ORM) to interact with a PostgreSQL database.
- React: Used for building the frontend user interface.
- Node.js & Vite: For running the frontend dev server and building production-ready files.
- Python & Flask: Backend server and API framework.
- PostgreSQL & SQLAlchemy: For database operations.
- Vitest & Cypress: Used for testing (unit tests and end-to-end tests).
- Docker: To containerize the app and manage development environments.
Make sure to check the package.json
(in /app
) and requirements.txt
(in /api
) for the full list of dependencies.
-
Branching Strategy:
- Main branches:
-
main
: The production-ready code. -
development
: The active development branch.
-
- Feature branches:
- When working on new features or bug fixes, create a new branch off
development
:git checkout -b feature/your-feature-name
- When working on new features or bug fixes, create a new branch off
- Main branches:
-
Pull Requests:
- Make sure to open a pull request from your feature branch into the
development
branch once your work is complete. - Include a detailed description of the work, and reference any issues it resolves.
- Make sure to open a pull request from your feature branch into the
-
Commit Messages:
- Use descriptive commit messages, following this pattern:
feat: Add new feature for user authentication fix: Correct typo in homepage banner
- Use descriptive commit messages, following this pattern:
-
Code Consistency: Follow the existing code style. We use ESLint for the frontend and Flake8 for the backend. Run the following before pushing:
npm run lint # Frontend flake8 . # Backend
-
Testing: Make sure your code is tested. Add tests for any new functionality, and ensure all existing tests pass:
- Unit tests:
cd app npm test # Frontend (using Vitest)
- End-to-end tests:
cd app npm run cypress:open # Launch Cypress for e2e tests
- Unit tests:
-
Pull Requests: Keep PRs small and focused. If your PR is too large, consider splitting it into multiple smaller ones.
-
Documentation: Update relevant documentation if you make changes to the code.
Here are some common commands you will use during development:
-
Start frontend development server:
cd app npm run dev
-
Start backend development server:
cd api flask run
-
Run tests:
cd app npm test # Frontend unit tests npm run cypress:open # Frontend e2e tests cd api pytest # Backend tests
-
Lint code:
cd app npm run lint # Frontend cd api flake8 . # Backend
-
Format code:
cd app npm run format # Frontend
You can report bugs or request features by opening an issue on our GitHub Issues page.
Feel free to reach out to the team via GitHub discussions or our Slack channel. We're here to help!
Onboarding Links
Project Links
Design Links
- HUU Design Wiki
- HUU Design Onboarding / Process / Best Practices
- Figma Project Link
- HUU Way of Working in Figma
- HUU Main Design File
- HUU Design System
- HUU Brand Style Guide
- HUU Design Google Folder
Research Links
- HUU Research Wiki
- HUU Research Onboarding / Process / Best Practices
- Figma Project Link
- HUU Research Google Folder
- Resources for learning, how-tos, guides, ebooks for new researchers
- HUU Research Roadmap
- HUU Research Output Overview
- HUU Research Guides & Templates