Skip to content

chore: rename backend endpoints #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 31, 2025
Merged

Conversation

naim-ea
Copy link
Collaborator

@naim-ea naim-ea commented Jul 31, 2025

Summary by CodeRabbit

  • Documentation

    • Expanded and restructured the README with detailed setup instructions, a comprehensive list of API endpoints (including methods, parameters, and descriptions), and thorough documentation of database models.
  • Refactor

    • Updated several API endpoint paths for improved organization, while maintaining backward compatibility through temporary redirects from old endpoints.

@naim-ea naim-ea requested review from Villaquiranm and dtczelo July 31, 2025 08:56
@naim-ea naim-ea linked an issue Jul 31, 2025 that may be closed by this pull request
Copy link

vercel bot commented Jul 31, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
gnolove ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 31, 2025 0:56am

Copy link
Contributor

coderabbitai bot commented Jul 31, 2025

Walkthrough

The server documentation was significantly expanded, detailing environment variables, API endpoints, and database models. On the code side, HTTP route paths were reorganized to introduce new, more descriptive endpoint paths, while maintaining backward compatibility through temporary redirects from old endpoints to the new ones. No changes were made to exported code entities.

Changes

Cohort / File(s) Change Summary
Documentation Overhaul
server/README.md
Expanded and restructured documentation: added detailed environment variable table, comprehensive and categorized API endpoint listings with parameters, and a new section describing all database models and their fields.
Route Path Reorganization
server/main.go
Updated HTTP route paths to new, descriptive endpoints; implemented HTTP 307 redirects from old endpoints to new ones to preserve backward compatibility. No handler logic or exported entities were changed.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Server

    Client->>Server: Request to old endpoint (e.g., /getRepositories)
    Server-->>Client: HTTP 307 Redirect to new endpoint (e.g., /repositories)
    Client->>Server: Request to new endpoint (/repositories)
    Server-->>Client: Response from handler (unchanged)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Poem

In README fields and routes anew,
The server’s map was drawn and grew.
Old paths now gently point ahead,
While docs unveil what’s under thread.
A rabbit hops through docs so bright—
All endpoints clear, each field in sight!
🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/rename-backend-endpoints

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
server/README.md (2)

36-36: LGTM! Consider fixing markdown formatting.

The endpoint URL change from /getStats to /stats aligns with the RESTful naming convention.

Fix the bare URL formatting as flagged by markdownlint:

-- get stats (curl http://localhost:3333/stats?time=x): where x in (daily|weekly|monthly|yearly)
+- get stats (`curl http://localhost:3333/stats?time=x`): where x in (daily|weekly|monthly|yearly)

53-53: LGTM! Consider fixing markdown formatting.

The endpoint URL change from /getIssues to /issues follows the RESTful naming convention.

Fix the bare URL formatting as flagged by markdownlint:

-- get issues (curl http://localhost:3333/issues?label=help wanted):
+- get issues (`curl http://localhost:3333/issues?label=help wanted`):
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3b7f9c4 and 6c8b5c0.

📒 Files selected for processing (4)
  • server/README.md (2 hunks)
  • server/main.go (1 hunks)
  • src/app/actions.ts (3 hunks)
  • src/hooks/use-link-github.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/app/actions.ts (1)
server/handler/stats.go (1)
  • HandleGetNewestContributors (149-207)
🪛 markdownlint-cli2 (0.17.2)
server/README.md

36-36: Bare URL used

(MD034, no-bare-urls)


53-53: Bare URL used

(MD034, no-bare-urls)

🔇 Additional comments (6)
src/hooks/use-link-github.ts (1)

193-193: LGTM! Improved API organization.

The endpoint change from /getGithubUserAndTokenByCode to /github/oauth/exchange improves API organization by grouping GitHub-related endpoints under the /github/ prefix and uses more descriptive naming.

src/app/actions.ts (3)

24-24: LGTM! Cleaner RESTful endpoint.

The endpoint change from /getStats to /stats removes redundant "get" prefix and follows REST conventions where the HTTP method implies the action.


42-42: LGTM! Improved endpoint naming.

The endpoint change from /getIssues to /issues follows RESTful naming conventions by removing the redundant "get" prefix.


69-69: LGTM! Consistent with REST conventions.

The endpoint change from /getRepositories to /repositories aligns with the other endpoint updates to use cleaner, more RESTful URLs.

server/main.go (2)

102-104: LGTM! Excellent RESTful API improvement.

The endpoint renaming from /getRepositories to /repositories, /getStats to /stats, and /getIssues to /issues follows REST conventions by removing redundant "get" prefixes. The HTTP method already indicates the action.


108-109: LGTM! Improved GitHub endpoint organization.

The restructuring of GitHub-related endpoints with /github/verify and /github/oauth/exchange creates better API organization by:

  • Grouping related functionality under the /github/ namespace
  • Using more descriptive endpoint names (oauth/exchange vs the verbose original)

Copy link
Collaborator

@dtczelo dtczelo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You change them all, perfect !

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (5)
server/README.md (5)

18-33: Fix MD034 & MD058: wrap bare URL and add blank lines around the .env table

markdownlint flags the bare URL on Line 23 and the absence of blank lines before/after the table (MD058).
Applying the patch below eliminates both issues without affecting rendered output.

- - Create a `.env` file in the `/server` folder with the following variables:
-
-| Variable Name               | Required | Example / Description                                                  |
+ - Create a `.env` file in the `/server` folder with the following variables:
+
+| Variable Name               | Required | Example / Description                                                  |
 |----------------------------|----------|-----------------------------------------------------------------------|
 | GITHUB_API_TOKEN           | Yes      | GitHub API token for authentication                                   |
-| GITHUB_GRAPHQL_ENDPOINT    | Yes      | GitHub GraphQL endpoint (commonly: https://api.github.com/graphql)    |
+| GITHUB_GRAPHQL_ENDPOINT    | Yes      | GitHub GraphQL endpoint (commonly: <https://api.github.com/graphql>) |
 | GNO_GRAPHQL_ENDPOINT       | Yes      | Gno blockchain GraphQL endpoint                                       |
 | GNO_RPC_ENDPOINT           | Yes      | Gno blockchain RPC endpoint                                           |
@@
-| DISCORD_WEBHOOK_URL        | No       | Discord webhook for leaderboard notifications                         |
+| DISCORD_WEBHOOK_URL        | No       | Discord webhook for leaderboard notifications                         |
+
+<!-- blank line required after table for MD058 -->

131-133: Endpoint prefix inconsistency – consider namespacing /link under /github

Every other GitHub-related route is grouped under /github/*, yet the wallet–linking call sits at the root path. Moving it to /github/link (or similar) keeps the surface RESTful and predictable.

-  `POST /link`  
+  `POST /github/link`  

144-165: /api/onchain/* prefix breaks overall URL symmetry

All other resource groups live at the root (e.g. /contributors, /stats). Introducing an extra /api segment only for on-chain endpoints is surprising for consumers. Unless a gateway or versioning requirement mandates it, consider dropping the extra segment:

-  `GET /api/onchain/namespaces`
+  `GET /onchain/namespaces`

…apply similarly for the other three on-chain routes.


38-42: Minor log typo: “exiting” → “existing”

-issues: All updated exiting...
+issues: All updated existing…

180-316: Surround all model tables with blank lines (MD058)

markdownlint flags every table in the “Database Models” section for missing blank lines. Add a blank line before and after each table header to silence the warnings and keep the formatting consistent.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6c8b5c0 and 3666fb3.

📒 Files selected for processing (1)
  • server/README.md (2 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
server/README.md

23-23: Bare URL used

(MD034, no-bare-urls)


183-183: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


207-207: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


215-215: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


227-227: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


243-243: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


260-260: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


267-267: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


275-275: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


291-291: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


302-302: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


310-310: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (4)
server/README.md (4)

20-32: Add blank lines before & after the environment-variables table.
markdownlint (MD058) flags every table in this document. Inserting one blank line before and after each table silences the linter and improves readability.

-
-| Variable Name               | Required | Example / Description                                                  |
+
+
+| Variable Name               | Required | Example / Description                                                  |
 ...
-| DISCORD_WEBHOOK_URL        | No       | Discord webhook for leaderboard notifications                         |
-
+| DISCORD_WEBHOOK_URL        | No       | Discord webhook for leaderboard notifications                         |
+
+See `.env.example` if present for more details.

46-57: Document authentication / rate-limiting requirements for public endpoints.
The endpoint catalogue is comprehensive, but it omits whether calls require an Authorization header (bearer token), API key, or are completely open. This is crucial for client integration and for securing the service.

Recommend adding a short “Authentication” subsection right before the “API Endpoints” heading that states:

  • Supported auth schemes (GitHub token, cookie, etc.).
  • Which routes are public vs. require auth.
  • Expected HTTP status codes on auth failure (e.g. 401/403).

121-130: Clarify success & error responses for /github/verify + /github/link.
These routes perform sensitive wallet linkage. The README should list:

  • Expected success payload (fields & example).
  • Common error status codes (400, 409, 500) and payload shapes.
    This prevents client developers from reverse-engineering error semantics.

23-24: Wrap the bare URL in angle brackets to satisfy MD034.
This small change silences markdownlint and renders consistently across Markdown engines.

-| GITHUB_GRAPHQL_ENDPOINT    | Yes      | GitHub GraphQL endpoint (commonly: https://api.github.com/graphql)    |
+| GITHUB_GRAPHQL_ENDPOINT    | Yes      | GitHub GraphQL endpoint (commonly: <https://api.github.com/graphql>)  |
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3666fb3 and a657e84.

📒 Files selected for processing (3)
  • server/README.md (2 hunks)
  • server/main.go (1 hunks)
  • src/hooks/use-link-github.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/hooks/use-link-github.ts
  • server/main.go
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
server/README.md

23-23: Bare URL used

(MD034, no-bare-urls)


183-183: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


207-207: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


215-215: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


227-227: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


243-243: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


260-260: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


267-267: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


275-275: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


291-291: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


302-302: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


310-310: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)

🔇 Additional comments (1)
server/README.md (1)

8-9: Verify the stated Go version – 1.23.0 does not exist yet.
Go 1.22 is the latest stable release (Jul 2025). Requiring > 1.23.0 will confuse readers and automation scripts that parse prerequisites.

-Prerequisites: 
-- Golang > 1.23.0
+Prerequisites:
+- Golang ≥ 1.22.0

server/README.md Outdated

| Parameter | In | Type | Required | Description |
|--------------|-------|--------|----------|--------------------------------------------------------------------|
| time | query | string | Yes | Time period: `daily`, `weekly`, `monthly`, or `yearly` |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| time | query | string | Yes | Time period: `daily`, `weekly`, `monthly`, or `yearly` |
| time | query | string | No | Time period: `daily`, `weekly`, `monthly`, or `yearly`. If omitted, returns all-time stats (no explicit all time value). |

@dtczelo
Copy link
Collaborator

dtczelo commented Jul 31, 2025

Are you reworking the frontend now ?

@naim-ea
Copy link
Collaborator Author

naim-ea commented Jul 31, 2025

Are you reworking the frontend now ?

I'll do it once it's merged and deployed so that it can hit the new endpoints.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
server/README.md (3)

20-32: Surround tables with blank lines to satisfy MD058 and improve readability

markdownlint flags every table in this README because they are not preceded and followed by a blank line.
Adding a single blank line before and after each table silences MD058 and makes the raw Markdown easier to scan.

Example fix (repeat for all tables):

-See `.env.example` if present for more details.
-| Variable Name               | Required | Example / Description                                                  |
+See `.env.example` if present for more details.
+
+| Variable Name               | Required | Example / Description                                                  |-| DISCORD_WEBHOOK_URL        | No       | Discord webhook for leaderboard notifications                         |
+
+| DISCORD_WEBHOOK_URL        | No       | Discord webhook for leaderboard notifications                         |
+

Also applies to: 54-65, 72-77, 90-94, 105-110, 117-130, 136-140, 153-156, 167-170, 183-205, 207-213, 215-225, 227-241, 243-258, 260-265, 267-273, 275-289, 291-300, 302-308, 310-315


23-24: Wrap bare URLs in angle brackets to silence MD034

https://api.github.com/graphql is rendered as a bare link.
Wrap it (and any other bare URLs) in <…> or convert to [text](url).

-| GITHUB_GRAPHQL_ENDPOINT    | Yes      | GitHub GraphQL endpoint (commonly: https://api.github.com/graphql)    |
+| GITHUB_GRAPHQL_ENDPOINT    | Yes      | GitHub GraphQL endpoint (commonly: <https://api.github.com/graphql>) |

287-287: Property name ‘Url’ breaks existing naming convention

Earlier entities use URL (all caps). Keeping a single style prevents bugs in generated code & ORMs.

-| Url          | string      | Milestone URL                             |
+| URL          | string      | Milestone URL                             |
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a657e84 and 681c7db.

📒 Files selected for processing (2)
  • server/README.md (2 hunks)
  • server/main.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • server/main.go
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
server/README.md

23-23: Bare URL used

(MD034, no-bare-urls)


183-183: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


207-207: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


215-215: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


227-227: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


243-243: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


260-260: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


267-267: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


275-275: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


291-291: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


302-302: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)


310-310: Tables should be surrounded by blank lines

(MD058, blanks-around-tables)

🔇 Additional comments (1)
server/README.md (1)

74-75: Nice: parameter description now clarifies “all-time” behaviour

Good call adding the explicit note that omitting time returns all-time stats.
No further action required.

@naim-ea naim-ea requested a review from dtczelo July 31, 2025 12:59
@naim-ea naim-ea merged commit f979850 into main Jul 31, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rework names of endpoints
2 participants