fix: ai-powered-hackathon-idea-generator-service (closes #5)#86
Merged
ayomideadeniran merged 2 commits intoStellarDevHub:mainfrom Mar 25, 2026
Conversation
|
@AYo101o Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
Pr under review or i will give feedback or simply merge Pr. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dependency Installation
Installed the openai SDK to interact with OpenAI's Chat Completion API.
Generator Service
Created
generator.service.ts.
Implemented
GeneratorService
which uses the gpt-4o-mini model with JSON response format to ensure structured output.
The service generates a ProjectIdea object containing a title, description, key features, recommended tech, and difficulty.
API Routes
Created
generator.routes.ts.
Exposed a POST /api/generator/generate endpoint.
Registered the route in the main
index.ts.
Testing & Verification
Created
generator.test.ts.
Implemented integration tests with mocked OpenAI responses using Jest's ESM-compatible mocking (unstable_mockModule).
Resolved various ESM/TypeScript configuration issues in the test runner to ensure a stable testing environment.
Validation Results
Automated Tests
The test suite passed successfully:
PASS tests/generator.test.ts Generator API Integration Tests POST /api/generator/generate √ should generate a project idea with valid input (136 ms) √ should return 400 if required fields are missing (13 ms) Test Suites: 1 passed, 1 total Tests: 2 passed, 2 totalHow to Test Manually
You can test the endpoint using
curl:bash curl -X POST http://localhost:8080/api/generator/generate \ -H "Content-Type: application/json" \ -d '{ "theme": "Decentralized Finance", "techStack": ["React", "Solidity", "Ethers.js"], "difficulty": "Intermediate" }'closes #5