Prerequisites
Before you begin, ensure you have:- Node.js 18 or higher
- pnpm package manager
- PostgreSQL database (local or remote)
Installation
Configure environment variables
Create a
.env file in the project root with your database connection:Set up the database
Generate the Prisma client and run migrations to create your database schema:This creates the following tables:
Admin- Admin users with authenticationCategory- Product categoriesProduct- Tea and beverage productsOrder- Customer ordersOrderItem- Individual items in ordersNewsletterSubscriber- Email subscribers
Make Your First API Request
Now that your server is running, let’s test it with a real API call.Fetch all products
The response will be empty initially since you haven’t added any products yet. This is normal for a fresh installation.
Fetch products by category
Get products filtered by a specific category:Get a specific product
Retrieve a single product by ID:Next Steps
Congratulations! Your Kioto Teteria Backend is now running. Here’s what to explore next:Authentication
Learn how to create admin accounts and authenticate API requests
Products API
Explore all product endpoints including creation and management
Orders API
Handle customer orders and order processing
Categories API
Organize products with category management
Common Issues
Database connection errors
If you see connection errors, verify:- PostgreSQL is running
- Database credentials in
.envare correct - The database exists (create it with
createdb kioto_teteriaif needed)
Port already in use
If port 3000 is occupied, change thePORT variable in your .env file: