A modern code snippets collection built with Next.js and TypeScript, designed to help developers quickly find and implement common code patterns and solutions. This project serves as a practical resource for front-end development patterns and best practices.
This code snippets project provides a curated collection of reusable code examples, components, and patterns that can be easily integrated into various web development projects. It's built with performance and developer experience in mind, featuring a clean interface for browsing and implementing code snippets.
- Code Organization: Well-structured collection of code snippets by category and technology.
- Syntax Highlighting: Beautiful code presentation with proper syntax highlighting.
- Responsive Design: Fully responsive layout for all screen sizes.
- Dark/Light Mode: Theme support for comfortable viewing in any environment.
- Next.js - React framework for server-side rendering and static website generation.
- React - JavaScript library for building user interfaces.
- TypeScript - JavaScript with static typing.
- Tailwind CSS - Utility-first CSS framework for rapid UI development.
- Prism.js - Lightweight syntax highlighting library.
- React Syntax Highlighter - Syntax highlighting component for React.
code-snippets/
├── app/ # Source files for app pages
│ ├── snippets/ # Snippets section (page for code snippets)
│ ├── categories/ # Categories section (page for snippet categories)
│ ├── search/ # Search section (page for searching snippets)
│ ├── layout.tsx # Root layout component
│ └── page.tsx # Main landing page
│
├── components/ # Reusable components
│ ├── ui/ # UI(shadCN) components
│ ├── snippets/ # Snippet-related components
│ └── layout/ # Layout components
│
├── lib/ # Utility functions and configurations
│ ├── snippets/ # Snippet data and utilities
│ ├── utils/ # Helper functions
│ └── types/ # TypeScript type definitions
│
├── styles/ # Global styles and Tailwind configuration
├── public/ # Static assets
└── content/ # Snippet content and metadata
To set up this project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/Danielkhakbaz/Code-Snippets cd code-snippets
-
Install dependencies:
yarn
-
Run the development server:
yarn dev
-
Open http://localhost:3000 in your browser to see the project.
Here are some helpful scripts to assist in the development and maintenance of this project:
dev
: Runs the app in development mode.build
: Compiles the app for production.start
: Starts the production server.lint
: Lints and fixes files using ESLint.fix
: Formats files using Prettier.knip
: Analyzes the project structure and provides suggestions for improvement.check-prettier
: Checks the code format without making changes.