Valet-Wizard is a service management system designed for valet parking services.
- User Authentication: Secure user registration and login using NextAuth, JWT tokens, and sessions.
- Stripe Webhook Integration: Handles real-time payments and events via Stripe, enabling smooth payment processing.
- PostgreSQL Database: Reliable and secure relational database for managing user data, parking orders, and payment statuses.
- Admin Dashboard: Manage and view all valet parking orders, payment statuses, and system settings.
- Responsive UI: A modern and mobile-friendly user interface built with TailwindCSS for a seamless experience on all devices.
- Next.js: A React framework for server-side rendering and static site generation.
- PostgreSQL: A robust relational database used to store user data, orders, and payments.
- JWT & Sessions: Secure user authentication using JSON Web Tokens (JWT) and session management with NextAuth.
- Stripe: Integrated for processing online payments and handling Stripe webhooks to update payment statuses.
- React, TypeScript, Tailwind CSS
Check out the live version of Valet-Wizard here:
Valet-Wizard Deployment
Before you start, make sure you have the following installed:
- Node.js (v16 or higher) — Download Node.js
- PostgreSQL — Install PostgreSQL
- Stripe Account — Create a Stripe account
-
Clone the repository:
git clone https://github.com/iyilmaz24/Valet-Wizard.git cd Valet-Wizard
-
Install the dependencies:
npm install
-
Set up environment variables:
Create a
.env.local
file at the root of the project and add the following environment variables:NEXTAUTH_SECRET=<your-nextauth-secret> DATABASE_URL=postgresql://<username>:<password>@localhost:5432/valet_wizard STRIPE_SECRET_KEY=<your-stripe-secret-key> STRIPE_WEBHOOK_SECRET=<your-stripe-webhook-secret>
Replace
<your-nextauth-secret>
,<username>
,<password>
,<your-stripe-secret-key>
, and<your-stripe-webhook-secret>
with your actual values. -
Run database migrations:
After setting up the environment variables, run the following command to migrate the database schema:
npx prisma migrate dev
-
Start the development server:
Run the following command to start the application locally:
npm run dev
-
Access the app:
Once the server is running, open your browser and visit
http://localhost:3000
to view the app.
- Users can register and log in using NextAuth, which handles the session and JWT tokens for authentication.
- Users can view and manage parking orders via a simple dashboard.
- Users can place new parking orders, and the status of each order is tracked in the system.
- Payments are securely processed through Stripe.
- Webhook events from Stripe are handled by the system to ensure real-time updates to payment statuses.
To integrate Stripe for payment processing, follow these steps:
-
Go to the Stripe Dashboard and create a test API key and webhook secret.
-
In your Stripe dashboard, set up a webhook endpoint to listen to events at your app's
/api/stripe/webhook
endpoint. -
In your
.env.local
, add the following:STRIPE_SECRET_KEY=your_stripe_secret_key STRIPE_WEBHOOK_SECRET=your_stripe_webhook_secret
-
When a payment is made, Stripe will send a webhook event to your app. The application will process this event and update the payment status accordingly.
-
Create the PostgreSQL database:
If you haven’t already, create a new database in your PostgreSQL server:
CREATE DATABASE valet_wizard;
-
Database Schema:
The database schema is managed with Prisma ORM. After cloning the repository, run the following command to set up the database schema:
npx prisma migrate dev
This will apply the schema migrations and set up tables for managing users, orders, and payments.
-
Start the development server:
npm run dev
-
The app will be running at
http://localhost:3000
. -
Access the admin dashboard or create orders directly from the user interface.
Ensure that all the relevant API endpoints (e.g., authentication, payments, webhooks) are thoroughly tested. You can use tools like Postman or Insomnia for API testing and validation.
To update the database schema when you make changes, run:
npx prisma migrate dev
- Security: Be sure to use strong, unique values for your JWT secret, Stripe secret key, and Stripe webhook secret to ensure security.
- Stripe Testing: During development, make sure to test payments using Stripe’s testing environment before going live.
- PostgreSQL: Ensure your PostgreSQL server is running and accessible on the correct port before trying to connect.