Nahj AI Assistant

How can I help you today?

Ask me anything about software development

Architecture & Infrastructure

Project structure and infrastructure

Architecture and infrastructure define how your project is organized and managed. This section covers project structure (monorepo), version control with Git and GitHub, environment management, and deployment pipelines - the foundation that keeps your codebase maintainable as it grows.

Monorepo Structure

project/
frontend/
src/
package.json
backend/
src/
package.json
shared/
types/
utils/
package.json
turbo.json

Keep frontend, backend, and shared code in a single repository for easier maintenance and deployment.

Benefits
  • Shared types and utilities
  • Atomic commits across packages
  • Simplified dependency management

Environment Variables

Manage configuration across different environments securely.

Environment Files
  • .env - Local development (git ignored)
  • .env.example - Template for required variables (committed)
  • Use platform secrets for production (Railway, Vercel, etc.)
Keep Keys Out of Git
Avoid
Never commit .env files with real keys to git.

Version Control

Git best practices for team collaboration.

Branching Strategy
  • main - Production-ready code
  • develop - Integration branch for features
  • feature/* - Individual feature branches
Commit Messages
Use conventional commits: feat:, fix:, docs:, refactor:, test:

GitHub Workflow

Leverage GitHub features for better collaboration and automation.

Pull Requests
Always use PRs for code changes. Enable required reviews and status checks before merging.
GitHub Actions(Optional)
Automate testing, linting, and deployments. Run CI on every push and PR. Using it early helps you learn best practices.
Issues & Projects(Optional)
Track bugs and features with Issues. Use Projects for sprint planning and roadmaps. Useful for organizing your work even in solo projects.
Branch Protection(Optional)
Protect main branch: require PR reviews, passing CI, and up-to-date branches. Useful for learning even in solo projects.

Environments

Separate environments for different stages of development.

Development
localhost:3000

Local environment for active development. Uses local database and mock services.

Staging
staging.yourapp.com

Pre-production environment that mirrors production. Test features before release.

Production
yourapp.com

Live environment for end users. Never test directly here.

Use separate databases and API keys for each environment. Never share production credentials.