Skip to content

gdg-natal/attendees-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ GDG Attendees - Local Development Guide

This guide will help you run the GDG Attendees application locally in development mode.

πŸ“‹ Prerequisites

Required Software

Optional but Recommended

  • VS Code with Angular and Go extensions
  • Postman or Insomnia for API testing

πŸ› οΈ Quick Setup

Option 1: Automated Setup (Recommended)

# From the root directory
./dev-setup.sh

Option 2: Manual Setup

1. Setup API (Go Backend)

# Navigate to API directory
cd api

# Install dependencies
go mod download

# Run the API server
go run main.go

The API will be available at: http://localhost:3000

2. Setup Web (Angular Frontend)

# Navigate to web directory
cd web

# Install dependencies
npm install

# Start development server
npm run dev

The web app will be available at: http://localhost:4200

🌟 Development Scripts

We've created convenient scripts to make development easier:

Root Directory Scripts

  • ./dev-setup.sh - Complete setup and start both services
  • ./dev-start.sh - Start both API and Web in development mode
  • ./dev-stop.sh - Stop all development services
  • ./dev-test.sh - Run tests for both services

API Scripts (in /api directory)

  • go run main.go - Start API server
  • go test ./... - Run tests
  • go mod tidy - Clean up dependencies

Web Scripts (in /web directory)

  • npm run dev - Start development server with hot reload
  • npm run start - Start development server
  • npm run build - Build for production
  • npm run test - Run unit tests
  • npm run watch - Build and watch for changes

πŸ”— Application URLs

Service URL Description
Web App http://localhost:4200 Angular frontend
API http://localhost:3000 Go backend API
API Health http://localhost:3000/health Health check endpoint
API Docs http://localhost:3000/api/v1 API endpoints

πŸ—‚οΈ Project Structure

attendees-app/
β”œβ”€β”€ πŸš€ api/                    # Go backend
β”‚   β”œβ”€β”€ main.go               # Entry point
β”‚   β”œβ”€β”€ go.mod               # Go dependencies
β”‚   β”œβ”€β”€ app/                 # Application logic
β”‚   β”‚   β”œβ”€β”€ app.go          # Main app configuration
β”‚   β”‚   └── handler/        # HTTP handlers
β”‚   └── Dockerfile          # Docker configuration
β”‚
β”œβ”€β”€ 🌐 web/                   # Angular frontend
β”‚   β”œβ”€β”€ package.json        # Node.js dependencies
β”‚   β”œβ”€β”€ angular.json        # Angular configuration
β”‚   β”œβ”€β”€ src/                # Source code
β”‚   β”‚   β”œβ”€β”€ app/           # Angular components
β”‚   β”‚   β”œβ”€β”€ environments/  # Environment configs
β”‚   β”‚   └── assets/        # Static assets
β”‚   └── Dockerfile         # Docker configuration
β”‚
β”œβ”€β”€ πŸ—οΈ infra/                # Infrastructure
β”‚   └── k8s/               # Kubernetes manifests
β”‚
└── πŸ“ Development files
    β”œβ”€β”€ dev-setup.sh       # Setup script
    β”œβ”€β”€ dev-start.sh       # Start script
    └── README.md          # This file

πŸ”§ Environment Configuration

API Environment Variables

Create a .env file in the /api directory (optional):

PORT=3000
GIN_MODE=debug
CORS_ALLOWED_ORIGINS=http://localhost:4200
LOG_LEVEL=debug

Web Environment Configuration

The Angular app uses environment files:

  • src/environments/environment.ts - Default (development)
  • src/environments/environment.dev.ts - Development
  • src/environments/environment.prod.ts - Production

πŸ§ͺ Testing

API Tests

cd api
go test ./...

Web Tests

cd web
npm run test

End-to-End Testing

# Start both services first
./dev-start.sh

# Then run E2E tests (if configured)
cd web
npm run e2e

πŸ› Troubleshooting

Common Issues

1. Port Already in Use

# Find process using port 3000 (API)
lsof -i :3000
kill -9 <PID>

# Find process using port 4200 (Web)
lsof -i :4200
kill -9 <PID>

2. Node Modules Issues

cd web
rm -rf node_modules package-lock.json
npm install

3. Go Module Issues

cd api
go clean -modcache
go mod download

4. CORS Issues

Make sure the API is configured to allow requests from http://localhost:4200

πŸ“Š Development Monitoring

API Logs

The Go API provides structured logging. Check the console for:

  • Request logs
  • Error messages
  • Performance metrics

Web Development Server

Angular CLI provides:

  • Hot reload on file changes
  • Build error reporting
  • Lint warnings

πŸš€ Next Steps

Development Workflow

  1. Start development servers: ./dev-start.sh
  2. Make changes to code
  3. Test changes automatically (hot reload)
  4. Test API endpoints with Postman/curl
  5. Run tests before committing
  6. Build for production when ready

Adding Features

  1. API: Add new handlers in /api/app/handler/
  2. Web: Add new components in /web/src/app/
  3. Update tests for new functionality
  4. Update documentation

Production Deployment

When ready to deploy:

# Build production images
docker build -t gdg-attendees-api ./api
docker build -t attendees-app ./web

# Deploy to Kubernetes
cd infra/k8s
make deploy

πŸ“š Additional Resources

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

Happy coding! πŸŽ‰

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published