This simple project aims to return results to the user based on a search phrase passed from the Github Api.
The project is built in Ruby On Rails and a Reactjs client.
- Architecture: Monolith.
- Caching: No caching was added because of time constraints but as the app grows to support lots of users and if this is a majorly used feature, we may consider caching previously fetched requests.
- This runs on the main thread because it's data in demand and it's not great UX to defer it, should the load of requests grow, its own service would make sense.
- UI is built in React and React Query. Requery has excellent server data caching strategies to limit calls to the server
- Security: For this demo, I only took care of the origins from which we expect the API to be called, other headers can be added to make this better.
- Database: None was needed in this scenario.
- Tests: Rspec
- Search
- Sort Data by [stars, forks, help-wanted-issues, updated]
- Pagination
- Simple Swagger Api documentation
Clone the project
git clone https://github.com/NicholusMuwonge/github-repo-search.gitGo to the project directory
cd github-repo-searchInstall dependencies
bundle installAdd Project Master.key To be able to access the credentials, I use Rails credentials. I will share this whenever you'd like.
bundle installStart the server
bundle exec rails sNavigate to the Frontend folder in the project
cd frontend/github-repo-searchInstall dependencies with your favorite package manager, I used bun for this and build tool Vite
bun install / yarn / npm iAdd Environment variables like your backend service url host in a .env file, follow the .env.example
VITE_HOST=Start the server
bun run dev / yarn dev / npm run devTo run tests, run the following command
bundle exec rspecI didn't get plenty of time to write those for the frontend as well
Run this in the terminal
rswag:specs:swaggerizeand then Visit
http://localhost:3000/api-docs/index.html