A modern, AI-powered smart contract generator that uses DeepSeek LLM to create intelligent contracts for ResilientDB based on natural language descriptions.
- AI-Powered Generation: Uses DeepSeek LLM to understand your requirements and generate appropriate smart contracts
- Dark Theme UI: Beautiful, modern interface that matches your development tools
- Modular Architecture: Clean, maintainable codebase with reusable components
- Detailed Contract View: Comprehensive contract analysis with method explanations
- ResilientDB Integration: Generates contracts in the correct format for ResilientDB
- Node.js 18+
- npm or yarn
- DeepSeek API key
- Clone the repository:
git clone <repository-url>
cd smart-contract-generator- Install dependencies:
npm install-
Configure your DeepSeek API key (see Configuration section below)
-
Start the development server:
npm run dev- Open your browser to
http://localhost:5173
-
Get your API key: Sign up at DeepSeek Platform and get your API key
-
Configure server-side environment variables (the key is never embedded in client JavaScript):
Local development (
npm run dev) โ create a.envfile in the project root:DEEPSEEK_API_KEY=your_actual_deepseek_api_key_here DEEPSEEK_BASE_URL=https://api.deepseek.com/v1 DEEPSEEK_MODEL=deepseek-chat
Vite serves
/api/deepseekin dev and injects these values only on the server side of that route.Production (e.g. Vercel) โ add the same variables in the hostโs environment settings (without the
VITE_prefix). The app uses the serverless route atapi/deepseek.ts, which readsprocess.env.DEEPSEEK_API_KEY.Do not put your real API key in
VITE_*variables for a public deployment; those are exposed in the browser bundle.
-
Describe Your Contract: Enter a natural language description of what you want your smart contract to do. For example:
"Create a contract where Alice and Bob need to approve before any changes can be made to the document" -
Generate: Click "Generate Contract" and wait for the AI to create your contract
-
Review: View the generated contract details, methods, and JSON format
-
Copy or Download: Use the generated Solidity or JSON in your ResilientDB application
- LandingPage: Intro and onboarding
- ChatbotPage: Main chat interface for contract generation
- Chatbot: The core chat and contract generation logic
- Footer: App footer and links
- Navbar: App navigation and branding
- UI assets: Custom CSS and SVGs for styling
- deepseekService.ts: Calls
/api/deepseek(browser โ your backend โ DeepSeek) - api/deepseek.ts: Vercel serverless handler for
/api/deepseekplus sharedforwardToDeepSeek(used by Vite dev middleware) - contractValidator.ts: Validates and analyzes generated contracts
api/ # Vercel serverless: `/api/deepseek` (single module so deploy bundles reliably)
src/
โโโ components/ # React components (Navbar, Footer, etc.)
โโโ Pages/ # Main pages (LandingPage, ChatbotPage)
โโโ services/ # Business logic (deepseekService, contractValidator, Chatbot)
โโโ assets/ # Images and SVGs
โโโ App.tsx # Main application (handles navigation)
โโโ main.tsx # Entry point
โโโ index.css # Global styles
โโโ components/ui/ # UI-specific CSS
- Navigation is handled via React state in
App.tsx.
The application is configured to use DeepSeek's API for smart contract generation. The integration includes:
- Automatic API calls to DeepSeek's chat completions endpoint
- Structured prompts optimized for smart contract generation
- Error handling with user feedback
- Response parsing to extract contract details and convert to ResilientDB format
The browser only calls /api/deepseek. That route must have access to:
DEEPSEEK_API_KEY=your_api_key_here
DEEPSEEK_BASE_URL=https://api.deepseek.com/v1
DEEPSEEK_MODEL=deepseek-chatnpm run preview serves static files only and does not run the dev API middleware. For a local production-like test, use vercel dev or deploy to Vercel.
The application uses Tailwind CSS with a custom dark theme. You can customize:
- Colors in
tailwind.config.js - Global styles in
src/index.css - Component-specific styles in each component
Modify the system prompt in the DeepSeek service to change how contracts are generated.
npm run buildThe built files in dist/ can be deployed to any static hosting service:
- Vercel
- Netlify
- GitHub Pages
- AWS S3
- etc.
Important: For production deployment, use environment variables to configure your API key instead of hardcoding it in the source code.
We're excited to participate in Hacktoberfest 2025! This is a great opportunity for developers of all skill levels to contribute to open source projects and earn some awesome swag.
-
Sign up for Hacktoberfest 2025
- Visit hacktoberfest.com
- Register with your GitHub account
- Choose between contributing to open source or planting trees
-
Find Issues to Work On
- Look for issues labeled with
hacktoberfestin our repository - Check out
good first issuelabels for beginner-friendly tasks - Browse our Issues page for available tasks
- Look for issues labeled with
-
Contribution Guidelines
- Fork this repository
- Create a new branch for your contribution:
git checkout -b feature/your-feature-name - Make your changes following our coding standards
- Test your changes thoroughly
- Submit a pull request with a clear description
- ๐ข Good First Issues: Perfect for first-time contributors
- ๐ก Intermediate: For developers with some experience
- ๐ด Advanced: For experienced developers looking for a challenge
- ๐ Documentation: Help improve our docs and guides
- ๐ Bug Fixes: Help us squash bugs and improve stability
- New Features: Add functionality to improve the smart contract generator
- UI/UX Improvements: Enhance the user interface and experience
- Documentation: Improve guides, tutorials, and code comments
- Testing: Add unit tests, integration tests, or end-to-end tests
- Bug Fixes: Help identify and fix issues
- Performance: Optimize code and improve application performance
- Accessibility: Make the application more accessible to all users
To ensure your contribution is accepted:
- Your code follows our existing style and conventions
- You've tested your changes locally
- Your pull request includes a clear description of changes
- You've linked any related issues
- Your commits are well-documented with clear messages
All valid contributions will be:
- Reviewed promptly by our maintainers
- Merged if they meet our quality standards
- Counted toward your Hacktoberfest 2025 progress
- Acknowledged in our contributors list
- Join our discussions in GitHub Discussions
- Check out our Contributing Guide for detailed information
- Feel free to ask questions in issue comments
Happy Hacking! ๐
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.
If you encounter any issues:
- Check the browser console for errors
- Verify
DEEPSEEK_API_KEYis set for the server (.envlocally, or Vercel project env vars) - Ensure you have a stable internet connection
- Check the DeepSeek API status page
- Support for more contract frameworks (Ethereum, Solana, etc.)
- Contract validation and testing
- Template library for common contract patterns
- Integration with ResilientDB deployment
- Contract versioning and history
- Multi-language support
- Advanced contract analysis
- Support for other LLM providers (OpenAI, Anthropic, etc.)