Welcome to the GONews project! This guide will help you get started with the newly organized codebase.
GONews/
βββ π README.md # You are here!
βββ π οΈ Makefile # Build commands
βββ π³ docker-compose.yml # Main Docker setup
βββ π docs/ # All documentation
βββ π§ͺ tests/ # Tests and test scripts
βββ π deployments/ # Deployment configurations
βββ π monitoring/ # Observability setup
βββ ποΈ cmd/ # Application entry points
βββ π internal/ # Private application code
βββ π¦ bin/ # Compiled binaries (auto-generated)
βββ π οΈ scripts/ # Utility scripts
# Clone and enter the project
cd /Users/madraka/GONews
# Copy environment file
cp .env.example .env # Edit with your settings
# Install dependencies
go mod download# Start database and services
make db-up
# Run migrations
make migrate-up
# Verify setup
make migrate-status# Build and run locally
make build && make run
# Or use hot reload with Air
air# Start all services (API + Database + Monitoring)
make dev-all-up
# View logs
docker-compose logs -f api
# Stop all services
make dev-all-down# Run unit tests
make test
# Run integration tests
make integration-test
# Test API endpoints
./tests/scripts/quick_test.sh
# Test observability stack
./tests/scripts/test_observability.sh| What you need | Where to find it |
|---|---|
| π§ API Handlers | internal/handlers/ |
| π£οΈ Routes | internal/routes/ |
| ποΈ Database Models | internal/models/ |
| π Middleware | internal/middleware/ |
| π API Documentation | docs/api/swagger.json |
| π§ͺ Test Scripts | tests/scripts/ |
| π³ Docker Configs | deployments/docker/ |
| π Monitoring | monitoring/ |
| π§ Build Scripts | scripts/build/ |
# Jump to key directories
cd internal/handlers # API handlers
cd docs/api # API documentation
cd tests/scripts # Test scripts
cd deployments/dev # Development configs
cd monitoring/ # Observability configs- Create Handler: Add to
internal/handlers/ - Add Route: Register in
internal/routes/ - Add Tests: Create test in
tests/ - Update Docs: Run
swag initto update Swagger
# Create new migration
make migrate-create name=add_new_table
# Apply migrations
make migrate-up
# Rollback migration
make migrate-down
# Check migration status
make migrate-status# Quick API test
./tests/scripts/quick_test.sh
# Verify handlers work
./tests/scripts/verify_handlers.sh
# Test with authentication
./tests/scripts/test_api_authenticated.sh# Start monitoring stack
make metrics-up
# View metrics: http://localhost:9090 (Prometheus)
# View dashboards: http://localhost:3000 (Grafana)
# API metrics: http://localhost:8080/metrics| Topic | Location | Description |
|---|---|---|
| API Reference | docs/api/ |
Swagger documentation, API guides |
| Setup Guides | docs/guides/ |
Implementation and configuration guides |
| Test Results | docs/reports/ |
Test reports and deployment status |
| Database | docs/migration/ |
Migration guides and database docs |
- π API Docs:
docs/api/swagger.json- Complete API specification - π Observability:
docs/guides/OBSERVABILITY_GUIDE.md- Monitoring setup - π Security:
docs/guides/enhanced_security_guide.md- Security best practices - π€ AI Integration:
docs/guides/ai_integration_guide.md- AI features guide
# Check API health
curl http://localhost:8080/health
# Check all container status
docker-compose ps
# View container logs
docker-compose logs api# Run debug server (in debug/ directory)
make debug-server
# Run debug client
make debug-client
# Check metrics endpoint
curl http://localhost:8080/metrics- Port conflicts: Check if ports 8080, 5432, 6379 are available
- Database connection: Ensure PostgreSQL is running (
make db-up) - Redis connection: Ensure Redis is running
- Missing migrations: Run
make migrate-up
- β
Place handlers in
internal/handlers/ - β
Keep business logic in
internal/services/ - β Put tests near the code they test
- β Update documentation when adding features
- β
Binaries are auto-ignored (in
bin/) - β Use meaningful commit messages
- β Test before committing
- β
Keep
.envfiles out of git
- β
Use
make dev-all-upfor full development stack - β
Use
make testbefore pushing changes - β
Check
make lintfor code quality - β
Update Swagger docs with
swag init
- π Full Documentation: Browse
docs/directory - π§ͺ Test Examples: Check
tests/scripts/for examples - π§ Build Commands: Run
make helpfor all available commands - π Monitoring: Access Grafana at http://localhost:3000
# See all available make commands
make help
# Check project status
make status
# Run comprehensive tests
make test-all
# View API documentation
open http://localhost:8080/swagger/index.htmlπ Happy coding! The project is now well-organized and ready for development. All documentation is in English and properly categorized for easy access.