Welcome to the DeepSeek Local Skeleton project! This is a foundational setup to work with DeepSeek locally and build a Go backend to interact with it. Whether you're experimenting or building a full-fledged application, this skeleton provides the essential structure to get started.
Before diving in, ensure you have the following installed and configured:
-
Ollama:
- Download and install Ollama from https://ollama.com/.
- If you move the Ollama folder, set the
PATHenvironment variable to point to its new location. - Set the
OLLAMA_MODELSenvironment variable to specify where your models will be stored. - Verify the installation by running:
ollama --version
-
DeepSeek Model:
- Install the DeepSeek model of your choice. You can find models on Hugging Face or the Ollama library.
- For example, to install the
deepseek-r1:8bmodel, run:ollama run deepseek-r1:8b
-
PostgreSQL:
- Ensure PostgreSQL is installed and running.
- Check the status of PostgreSQL:
pg_ctl status -D <path-to-postgresql>\PostgreSQL\data
- Start PostgreSQL if it’s not running:
pg_ctl start -D <path-to-postgresql>\PostgreSQL\data
- Create the database for the project:
CREATE DATABASE material_todo_go;
Here’s an overview of the project structure:
📂 deepseekBackend
├── 📁 controllers # API controllers (auth, user, notes)
├── 📁 models # Database models (User, Note)
├── 📁 database # Database connection (PostgreSQL)
├── 📁 routes # API route definitions
├── 📁 utils # Utility functions (JWT handling)
├── 🌍 main.go # Entry point of the app
├── 📜 go.mod # Go modules
├── 📜 README.md # Project documentation
-
Clone the Repository:
Clone this repository to your local machine. -
Install Dependencies:
Run the following command to install the required Go dependencies:go mod tidy
-
Configure Environment Variables:
Set up the necessary environment variables for the database connection, JWT secrets, and Ollama configurations. -
Run the Application:
Start the Go backend by running:go run main.go
-
Test the API:
Use tools like Postman or cURL to test the API endpoints defined in theroutesfolder.
To interact with the DeepSeek model, you can use the following API endpoint:
- Endpoint:
POST http://localhost:2626/api/chats/start - Request Body:
{ "prompt": "How much water should I drink a day?" }
-
Postman:
- Set the request type to
POST. - Enter the URL:
http://localhost:2626/api/chats/start. - Go to the Body tab, select raw, and choose JSON format.
- Paste the JSON payload:
{ "prompt": "How much water should I drink a day?" } - Click Send to get the response.
- Set the request type to
-
cURL:
curl -X POST http://localhost:2626/api/chats/start \ -H "Content-Type: application/json" \ -d '{"prompt": "How much water should I drink a day?"}'
{
"response": "The general recommendation is to drink about 8 glasses (64 ounces) of water per day, but individual needs may vary based on factors like age, weight, activity level, and climate."
}- DeepSeek Integration: Work with DeepSeek models locally using Ollama.
- PostgreSQL Database: Store and manage data efficiently.
- RESTful API: Build scalable and maintainable APIs with Go.
- JWT Authentication: Secure your application with token-based authentication.
This project is open-source and available under the MIT License. Feel free to use, modify, and distribute it as needed.
Contributions are welcome! If you have any suggestions, bug reports, or feature requests, please open an issue or submit a pull request.
Happy coding! 🎉
Let’s build something amazing with DeepSeek and Go! 🚀