This repository demonstrates how to build a scalable and modular application using SvelteKit and tRPC. The project is structured to promote maintainability, separation of concerns, and ease of scalability.
Full Tutorial Here: Ultimate Guide to SvelteKit tRPC: Build Scalable, High-Performance Apps
- Modular folder structure for large-scale projects.
- Integration of tRPC for efficient type-safe APIs.
- Example app fetching coffee data (hot and iced coffee) from a sample API.
This project serves as a foundation for building scalable apps using SvelteKit and tRPC. It demonstrates best practices for structuring large projects and includes a functional example of fetching and displaying coffee data.
Follow these steps to set up the project locally:
Ensure you have the following installed on your machine:
- Node.js (v16 or higher)
- npm or yarn
- Clone the repository:
git clone https://github.com/michaelbelete/Sveltekit-tRPC.git
cd Sveltekit-tRPC
- Install dependencies:
npm install
- Start the development server:
npm run dev
- Open your browser and navigate to:
http://localhost:5173
The project is organized as follows:
src/
├── lib/ # Shared utilities and components
├── routes/ # SvelteKit pages and endpoints
├── server/ # Backend logic and tRPC setup
│ ├── routers/ # tRPC routers
│ ├── services/ # Business logic services
│ ├── validations/ # Zod validation schemas
- Run the project locally to explore the example functionality.
- Use the modular structure as a guide for your own projects.
- Refer to the code for best practices on integrating tRPC with SvelteKit.
Contributions are welcome! If you’d like to contribute:
- Fork the repository.
- Create a feature branch:
git checkout -b feature-name
- Commit your changes:
git commit -m "Add feature"
- Push to the branch:
git push origin feature-name
- Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.