A modern, full-stack code snippet management application built with Next.js, allowing developers to create, store, edit, and organize their code snippets efficiently.
- Create Snippets: Add new code snippets with syntax highlighting.
- Edit & Update: Modify existing snippets seamlessly.
- View Snippets: Browse and search through your snippet collection
- Responsive Design: Modern UI built with Tailwind CSS and shadcn/ui components
- Database Integration: Persistent storage using Prisma ORM
- Type-Safe: Full TypeScript support throughout the application
- Framework: Next.js 14+ with App Router
- Database: Prisma ORM
- Styling: Tailwind CSS
- UI Components: shadcn/ui
- Language: TypeScript
snippet/
├── src/
│ ├── actions/ # Server actions
│ ├── app/ # Next.js app directory
│ │ ├── snippet/ # Snippet routes
│ │ │ ├── [id]/ # Dynamic snippet pages
│ │ │ │ ├── edit/ # Edit snippet page
│ │ │ │ └── page.tsx
│ │ │ └── new/ # Create new snippet
│ │ └── page.tsx # Home page
│ ├── components/ # React components
│ │ ├── EditSnippetFrom.tsx
│ │ └── ui/ # shadcn/ui components
│ └── lib/ # Utilities and configurations
├── prisma/ # Database schema
└── public/ # Static assets
- Node.js 18+
- npm, yarn, pnpm, or bun
- Database (PostgreSQL, MySQL, or SQLite)
-
Clone the repository
git clone https://github.com/omkarhole/snippet.git cd snippet -
Install dependencies
npm install # or yarn install # or pnpm install
-
Set up environment variables
cp .env.example .env.local
Update the
.env.localfile with your database connection string:DATABASE_URL="your-database-connection-string" -
Set up the database
npx prisma generate npx prisma db push
-
Run the development server
npm run dev # or yarn dev # or pnpm dev
-
Open your browser Visit http://localhost:3000 to see the application.
- Navigate to
/snippet/new - Fill in the snippet title and code
- Click "Save" to store your snippet
- Browse all snippets on the home page
- Click on any snippet to view its details
- Use the search functionality to find specific snippets
- Navigate to any snippet's detail page
- Click the "Edit" button
- Modify the content and save changes
npm run dev- Start the development servernpm run build- Build the application for productionnpm run start- Start the production servernpm run lint- Run ESLint for code linting
The application uses Prisma with a simple schema for managing snippets. Check prisma/schema.prisma for the complete database structure.
This project leverages shadcn/ui for consistent and accessible UI components:
- Button
- Input
- Label
- Textarea
The easiest way to deploy your Next.js app is to use the Vercel Platform.
- Push your code to a Git repository
- Connect your repository to Vercel
- Set up your environment variables
- Deploy!
- Netlify: Follow the Next.js deployment guide
- Railway: Easy database and app hosting
- DigitalOcean App Platform: Full-stack deployment
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is open source and available under the MIT License.
Built with ❤️ by Omkar Hole