A simple, fast, and secure code sharing platform. Share your code snippets and files instantly with a permanent URL.
- No Accounts Required: Just upload and share
- Universal Access: Works with any text editor or IDE
- CLI-Friendly: Use curl to upload and download files
- Permanent Storage: No expiration, no cleanup required
- Private Files: Optional access codes for sensitive code
- Syntax Highlighting: Automatic language detection and highlighting
- File Type Support: Supports all major programming languages
- Frontend: Next.js 15 with App Router, TypeScript, Tailwind CSS
- Backend: PostgreSQL with Drizzle ORM, Oslo for auth
- File Storage: Direct database storage
- CLI Access: curl for universal file operations
- Node.js 18+ and pnpm
- PostgreSQL database
- Clone the repository:
git clone https://github.com/destinydinam/codeshare.git
cd codeshare- Install dependencies:
pnpm install- Set up environment variables:
cp env.example .envEdit .env with your database URL:
DATABASE_URL="postgresql://username:password@localhost:5432/codeshare"
NEXT_PUBLIC_APP_URL="http://localhost:3000"- Set up the database:
pnpm db:push- Start the development server:
pnpm devVisit http://localhost:3000 to see the app.
POST /api/uploadForm Data:
file(optional): File to uploadcontent(optional): Direct contentfilename(required if content): Filename for contentaccessCode(optional): Access code to make file private
GET /api/files/[id]/download
POST /api/files/[id]/downloadGET /api/files/[id]?accessCode=codeDELETE /api/files/[id]POST /api/files/[id]/curlcurl -X POST $APP_URL/api/upload \
-F "file=@example.js"curl -X POST $APP_URL/api/upload \
-F "content=console.log('Hello World')" \
-F "filename=hello.js"curl -X POST $APP_URL/api/upload \
-F "file=@example.js" \
-F "accessCode=secret123"curl -X POST $APP_URL/api/upload \
-F "content=console.log('Hello World')" \
-F "filename=hello.js" \
-F "accessCode=secret123"curl -X GET $APP_URL/api/files/[file-id]/downloadcurl -X POST $APP_URL/api/files/[file-id]/download \
-F "accessCode=secret123"curl -X GET $APP_URL/api/files/[file-id]/download -o "/path/to/folder/filename.js"CodeShare supports a wide range of file types:
- JavaScript/TypeScript:
.js,.jsx,.ts,.tsx - Python:
.py,.pyw,.pyi - Java:
.java - C/C++:
.c,.cpp,.cc,.cxx,.h,.hpp - C#:
.cs - Go:
.go - Rust:
.rs - PHP:
.php - Ruby:
.rb - Swift:
.swift - Kotlin:
.kt,.kts - Scala:
.scala,.sc - HTML/CSS:
.html,.css,.scss,.sass,.less - Markup:
.xml,.json,.yaml,.yml,.toml - Shell:
.sh,.bash,.zsh,.fish,.ps1 - SQL:
.sql - R:
.r - MATLAB:
.m - Lua:
.lua - Perl:
.pl,.pm - Haskell:
.hs,.lhs - Erlang:
.erl,.hrl - Elixir:
.ex,.exs - Clojure:
.clj,.cljs - F#:
.fs,.fsx - Dart:
.dart - Assembly:
.asm,.s - Documentation:
.md,.txt,.log
# Generate migration
pnpm db:generate
# Push schema changes
pnpm db:push
# Open database studio
pnpm db:studio# Lint code
pnpm lint
# Type check
pnpm build- Connect your GitHub repository to Vercel
- Set environment variables in Vercel dashboard
- Deploy automatically on push to main branch
- Connect your GitHub repository to Railway
- Add PostgreSQL service
- Set environment variables
- Deploy automatically
- Set up PostgreSQL database
- Configure environment variables
- Build and run with Docker or directly
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
MIT License - see LICENSE for details.
Built with ❤️ by Destiny Dinam
- X: @destinydinam
- GitHub: @destinydinam