Thank you for your interest in contributing to the Greetings API! This document provides guidelines and information for contributors.
The Greetings API is a simple greeting service with a beautiful frontend. It serves greetings in multiple languages through a REST API and provides a user-friendly web interface. The project is built with Go for the backend and TypeScript for the frontend, and uses Dagger for CI/CD automation.
-
Fork the repository on GitHub by clicking the "Fork" button at the top right of the repository page.
-
Clone your fork to your local machine:
git clone https://github.com/YOUR_USERNAME/greetings-api.git cd greetings-api -
Add the upstream remote to keep your fork in sync:
git remote add upstream https://github.com/kpenfound/greetings-api.git
-
Keep your fork updated by regularly pulling from upstream:
git fetch upstream git checkout main git merge upstream/main
- Go 1.18 or higher
- Node.js (for the frontend)
- Dagger for running CI/CD operations
The project follows a monorepo structure with both backend and frontend components:
greetings-api/
├── main.go # Go backend server
├── main_test.go # Go backend tests
├── greetings.json # Greeting data in multiple languages
├── go.mod # Go module dependencies
├── CONTRIBUTING.md # Developer documentation
├── docs/ # Product documentation
│ ├── index.mdx # Main docs file
├── website/ # Frontend application
│ ├── index.html # Main HTML file
│ ├── package.json # Frontend dependencies
│ └── cypress/ # E2E tests
├── .dagger/ # Dagger CI/CD modules
│ ├── backend/ # Backend build module
│ ├── frontend/ # Frontend build module
│ └── workspace/ # Workspace configuration
└── dagger.json # Dagger configuration
- Language: Go
- Framework: Gorilla Mux for routing, CORS middleware
- Structure: Simple REST API with two endpoints:
GET /- Returns a random greetingGET /{language}- Returns a greeting in the specified language
- Data: Greetings are stored in
greetings.jsonand embedded in the binary - Testing: Uses
gotest.toolsfor unit tests
- Language: TypeScript
- Testing: Cypress for end-to-end tests
- Linting: ESLint with TypeScript support
- Build: Managed through Dagger modules
- Tool: Dagger for CI/CD operations
- Modules: Separate modules for backend, frontend, and workspace management
- Functions: Build, test, lint, serve, and release operations
Using Dagger (Recommended):
# Serve both backend and frontend
dagger call serve up
# Or run from remote without cloning
dagger -m github.com/kpenfound/greetings-api call serve upThe frontend will be available at http://localhost:8081/ and the backend at http://localhost:8080/
Backend Tests:
# Using Dagger
dagger call test
# Or directly with Go
go test ./...Frontend E2E Tests:
# Using Dagger (recommended)
dagger call check
# Or directly with npm
cd website
npm run test:e2eBackend Linting:
# Using Dagger
dagger call lintFrontend Linting:
# Using Dagger (part of check command)
dagger call check
# Or directly with npm
cd website
npm run lintdagger call build- Build the backend and frontenddagger call check- Run the complete CI checksdagger call lint- Lint the Go codedagger call test- Run unit testsdagger call serve up- Serve the application locallydagger call release- Create a GitHub release
- Go: Follow standard Go formatting (
go fmt) - TypeScript: Follow the ESLint configuration in the project
- Commits: Use clear, descriptive commit messages
- Developer Docs: Update CONTRIBUTING.md with any architectural changes
- Product Docs: Update docs/ with relevant product changes
- All new Go code should include unit tests
- Frontend changes should not break existing E2E tests
- Run the full test suite before submitting PRs:
dagger call check
-
Create a feature branch from
main:git checkout -b feature/your-feature-name
-
Make your changes following the code style guidelines
-
Test your changes thoroughly:
dagger call check
-
Commit your changes with clear commit messages
-
Push to your fork:
git push origin feature/your-feature-name
-
Create a Pull Request on GitHub with:
- Clear description of changes
- Reference to any related issues
- Screenshots if UI changes are involved
If you need help or have questions:
By contributing to this project, you agree that your contributions will be licensed under the same license as the project.
Thank you for contributing to the Greetings API! 🎉