https://github.com/sanaro99/django-svelte-ecommerce
A production-ready, modern e-commerce platform built with: Django + Django REST Framework (backend, API, OAuth2, Railway-ready), SvelteKit (frontend, DaisyUI, SEO friendly, Vercel-ready), PostgreSQL (Supabase)
https://github.com/sanaro99/django-svelte-ecommerce
django django-rest-framework ecommerce oauth2 postgresql shop svelte
Last synced: 3 months ago
JSON representation
A production-ready, modern e-commerce platform built with: Django + Django REST Framework (backend, API, OAuth2, Railway-ready), SvelteKit (frontend, DaisyUI, SEO friendly, Vercel-ready), PostgreSQL (Supabase)
- Host: GitHub
- URL: https://github.com/sanaro99/django-svelte-ecommerce
- Owner: sanaro99
- License: gpl-3.0
- Created: 2025-06-05T21:20:35.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-10T08:29:26.000Z (about 1 year ago)
- Last Synced: 2025-07-02T15:42:45.363Z (about 1 year ago)
- Topics: django, django-rest-framework, ecommerce, oauth2, postgresql, shop, svelte
- Language: Python
- Homepage: https://django-svelte-ecommerce.vercel.app
- Size: 487 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# django-svelte-ecommerce
A production-ready, modern e-commerce platform built with:
* **Django + Django REST Framework** (backend, API, OAuth2, Railway-ready)
* **SvelteKit** (frontend, SEO friendly, Vercel-ready)
* **PostgreSQL** (Supabase)
## Live Demo
Frontend: [https://django-svelte-ecommerce.vercel.app](https://django-svelte-ecommerce.vercel.app)
Backend: [https://django-svelte-ecommerce-production.up.railway.app](https://django-svelte-ecommerce-production.up.railway.app)
Test user credentials:
Please reach out to me for test user credentials or create your own by using the [registration form](https://django-svelte-ecommerce.vercel.app/register) on the frontend.
*Disclaimer:* This live demo is running on free-tier infrastructure across multiple global regions and providers. As a result, response times may vary and performance is not guaranteed. This environment is intended for testing and evaluation purposes only and *should not be used for production workloads.*
## Monorepo Structure
```
.
├── backend/ # Django project & API backend
├── frontend/ # SvelteKit app (SSR frontend)
```
## Local Development
**Prerequisites:**
* Python 3.10+
* Node.js 18+
* Supabase account
### Backend setup
```bash
cd backend
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env # Edit .env file as needed
python manage.py createsuperuser
python manage.py makemigrations
python manage.py migrate
python manage.py seed_data # To seed sample data using Faker library # Optional
```
Open /o/applications/ and add an application. Copy the client id and client secret and replace it in .env file.
client type: ```public``` \
Authorization grant type: ```authorization code``` \
Redirect URI list:
```
/oauth2-redirect.html
/auth/callback
```
Finally, run the server:
```bash
python manage.py runserver
```
### Frontend setup
```bash
cd frontend
npm install
npm run dev
```
## Running Tests
### Backend
```bash
cd backend
python manage.py test
```
For more info, check [backend/ecomm/TESTING.md](backend/ecomm/TESTING.md)
### Frontend
```bash
cd frontend
npm run test
```
## API Documentation and Usage Examples
API Documentation is available at [https://django-svelte-ecommerce-production.up.railway.app/docs/](https://django-svelte-ecommerce-production.up.railway.app/docs/)
Check [API Usage Examples](backend/README.md#api-usage-examples) to see how the API is used.
## Deployment
### Backend (Railway)
- Connect your GitHub repo to Railway.
- Choose root directory as `backend`.
- In Railway environment variables, set as per [backend/.env.example](./backend/.env.example):
- DJANGO_SECRET_KEY
- DB_NAME, DB_USER, DB_PASSWORD, DB_HOST, DB_PORT (Supabase Postgres)
- CLIENT_ID, CLIENT_SECRET
- BACKEND_PROD_URL, FRONTEND_PROD_URL
- In Railway Start Command:
```
gunicorn ecomm.wsgi:application
```
### Frontend (Vercel)
- Connect your repo to Vercel.
- Choose root directory as `frontend`.
- In Vercel environment variables, set as per [frontend/.env.example](./frontend/.env.example):
- VITE_BACKEND_BASE_URL
- VITE_CLIENT_ID
- VITE_FRONTEND_BASE_URL
- Build command: `npm run build` # This is the default build command
- Output directory: `build` # This is the default output directory
### Database (Supabase)
- Use Supabase Postgres in production.
- Provide DB credentials via Railway environment variables above.
- Use the shared pooler connection variables if you're connecting using Railway/Render
---