Skip to content

LT-SYAII/S-SnipCode

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

💻 SnipCode

SnipCode is a high-performance code repository platform. It features a Go backend and a React TypeScript frontend, designed with a decoupled architecture for security and scalability.


🛠️ Environment Configuration

Frontend API Setup

You must define your backend URL in the frontend directory.

  1. Go to /frontend.
  2. Create a .env file.
  3. Add: VITE_API_URL=http://localhost:8080.

👑 Admin Configuration (Important)

The backend includes a built-in seeding mechanism to create initial administrator accounts. You can customize these credentials directly in the source code before running the server.

How to Customize Admin Credentials

  1. Open main.go.
  2. Locate the seedAdminUsers() function.
  3. Change Usernames: Modify the admins := []string{"admin", "admin2"} slice to your preferred usernames.
  4. Change Password: Modify the fixedPassword := "admin123" variable.
  5. Set Roles: The system automatically assigns the "admin" role to these users, granting them full access to the dashboard.

The system uses Bcrypt to hash these passwords securely before saving them to the database.


🚀 Key Features

  • Type-Safe UI: Built with React and TypeScript for reliable data handling.
  • Fast API: Powered by Go (Gin Gonic) for low-latency responses.
  • Auto-Seeding: Automatic creation of admin accounts upon first run via seedAdminUsers().
  • Security: Centralized JWT authentication handled in storageService.ts.

📦 Installation

1. Backend (Go 1.23)

go mod tidy
go run main.go

The server will initialize the SQLite database (app.db) and seed the admins.

2. Frontend (React TS)

cd frontend
npm install
npm run dev

📂 Structure

  • backend/: Handlers, Models, and Admin Seeding logic.
  • frontend/: React Components (.tsx) and Storage Services (.ts).

⚠️ Support

If you encounter errors, please open a GitHub issue or contact the developer directly for critical bug reports.

Developed by Karin

About

SnipCode forked by K4r1nxz

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 74.1%
  • Go 22.0%
  • HTML 3.2%
  • CSS 0.7%