- Implementation and Conceptual Questions
- Fork this repository
- Create a source folder to contain your code.
- In the source directory, please create a PHP or Python web application
- Your application should accomplish the following:
- Connect to the GitHub API
- Find the nodejs/node repository
- Find the 1000 most recent commits (only hashes)
- Create a model and store the 1000 most recent commits in the database. Make sure to avoid any duplicates.
- Create a route and view that displays the recent commits by author from the database.
- Keep your solution flexible enough to be able to later on provide support for the bitbucket-api/gitlab-api, etc...
Challenge created by Circunomics.
How would your solution differ if you had to call another external API to store and receive the commits?
- There's an external HTTP API we call to store and retrieve commits.
- The external API accepts JSON arrays of commits (similar to
CommitDTO::toArray()). - The external API has endpoints like:
POST /commitsto save many commitsGET /commitswith query parameters (provider,owner,repo,offset,limit)
- It returns JSON, ideally grouped or paginated.
The only changes needed are the methods in the CommitRepository
must be updated to allow for requests to an external API.
- Zero changes to service and API classes.
- Clean separation of concerns.
- Easy to test and mock with fake HTTP responses.
- Consider caching external results to reduce API calls.
Microservices should be loosely coupled and independently deployable. Sharing a database introduces coupling.
- Avoid tight DB coupling: If the database is shared, encapsulate all SQL access within one service per table.
- Define clear service contracts.
- Add health checks and logging per service.
- Use OpenAPI / Swagger to document service endpoints.
-
VersionControlFetcherService
- Fetches commits via GitHub/GitLab APIs.
- Runs periodically or on-demand.
- Writes commits to the database.
- Queue-supported for rate-limiting and retries.
-
CommitStorageService
- Abstracts commit persistence.
- Handles deduplication and batch inserts.
- Owns the
commitstable schema. - Exposes an internal API for write access.
-
CommitQueryService
- Exposes endpoints for reading.
- Optimized for read patterns (caching, pagination).
- No write access to DB.
-
WebGateway/UIService
- Handles web routes (
/view,/get,/index). - Talks to
CommitQueryServiceand optionallyVersionControlFetcherService. - Lightweight logic; presentation-focused.
- Handles web routes (
-
ErrorLogging/MonitoringService
- Receives logs/events/errors from other services.
One PostgreSQL or MySQL instance with at least the following tables:
commits(central table)services_log(for debug/errors)- If supported, materialized views for reporting
Each service accesses the DB through its own repository layer (no direct cross-service SQL).
- Use REST or gRPC for internal service-to-service calls.
- Use message queues for async fetching, commit ingestion, or retries.
/services
/fetcher # fetch commits
/storage # handles inserts
/query # read-only APIs
/web-gateway # UI + routes
Use containers per service. Define their own
Dockerfile,composer.json, and tests.