first commit

This commit is contained in:
pacnpal
2024-10-28 17:09:57 -04:00
commit 2e1b4d7af7
9993 changed files with 1182741 additions and 0 deletions

View File

@@ -0,0 +1,150 @@
# Authentication System Setup
## Overview
This document outlines the setup of the authentication system, including both social and regular authentication.
## Backend Changes
### 1. Package Installation
```bash
pip install django-allauth==0.65.1 dj-rest-auth==6.0.0 djangorestframework==3.15.2 django-cors-headers==4.5.0
```
### 2. Configuration Files Modified
- thrillwiki/settings.py
- Added authentication apps
- Configured REST Framework
- Added CORS settings
- Added social auth providers
- Updated redirect URLs
- thrillwiki/urls.py
- Added dj-rest-auth URLs
- Added social auth URLs
### 3. New Files Created
- accounts/adapters.py
- Custom social account adapter
- Handles missing emails
- Sets profile pictures from social providers
### 4. Modified Files
- accounts/views.py
- Added email collection endpoint
- Updated authentication views
- accounts/urls.py
- Added new authentication endpoints
## Frontend Changes
### 1. Package Installation
```bash
npm install react-router-dom@6 axios@latest @react-oauth/google@latest
```
### 2. New Components Created
- src/contexts/AuthContext.tsx
- src/contexts/AuthProvider.tsx
- src/pages/Login.tsx
- src/pages/DiscordRedirect.tsx
- src/pages/EmailRequired.tsx
### 3. New Assets
- public/google-icon.svg
- public/discord-icon.svg
### 4. Modified Files
- src/App.tsx
- Added Google OAuth provider
- Added new routes
- src/api/client.ts
- Added authentication endpoints
- Added token handling
## Development Environment Setup
### Backend Setup
1. Create ***REMOVED*** file:
```env
DJANGO_SECRET_KEY=your_secret_key
DEBUG=True
ALLOWED_HOSTS=localhost,127.0.0.1
CORS_ALLOWED_ORIGINS=http://localhost:5173
# OAuth Credentials
GOOGLE_OAUTH2_CLIENT_ID=your_google_client_id
GOOGLE_OAUTH2_CLIENT_SECRET=your_google_client_secret
DISCORD_CLIENT_ID=your_discord_client_id
DISCORD_CLIENT_SECRET=your_discord_client_secret
# Database
DB_NAME=thrillwiki
DB_USER=postgres
DB_PASSWORD=postgres
DB_HOST=localhost
DB_PORT=5432
```
2. Run migrations:
```bash
python manage.py makemigrations
python manage.py migrate
```
### Frontend Setup
1. Create ***REMOVED*** file:
```env
VITE_API_URL=http://localhost:8000
VITE_GOOGLE_CLIENT_ID=your_google_client_id
VITE_DISCORD_CLIENT_ID=your_discord_client_id
```
2. Install dependencies:
```bash
cd frontend
npm install
```
## Testing Instructions
### Backend Testing
1. Start Django development server:
```bash
python manage.py runserver
```
2. Test endpoints:
- Regular auth: http://localhost:8000/api/auth/login/
- Social auth: http://localhost:8000/api/auth/google/login/
- User info: http://localhost:8000/api/auth/user/
### Frontend Testing
1. Start Vite development server:
```bash
cd frontend
npm run dev
```
2. Test flows:
- Regular login: http://localhost:5173/login
- Google login: Click "Continue with Google"
- Discord login: Click "Continue with Discord"
- Protected route: http://localhost:5173/settings
## Testing Checklist
- [ ] Regular login/registration
- [ ] Google OAuth flow
- [ ] Discord OAuth flow
- [ ] Email collection for social auth
- [ ] Profile picture import
- [ ] Protected route access
- [ ] Token persistence
- [ ] Error handling
- [ ] Logout functionality
## Notes
- Ensure all OAuth credentials are properly set up in Google Cloud Console and Discord Developer Portal
- Test all flows in incognito mode to avoid cached credentials
- Verify CSRF protection is working
- Check token expiration handling
- Test error scenarios (network issues, invalid credentials)

View File

@@ -0,0 +1,37 @@
# Changes Made - February 14, 2024
## Reactivated Removal
- Removed all reactivated-related files and configurations
- Cleaned up old client directory and unused configuration files
## Frontend Updates
- Updated to latest versions of all packages including Vite, React, and Material UI
- Configured Vite for optimal development experience
- Set up proper CORS and CSRF settings for Vite development server
- Improved build configuration with proper chunking and optimization
- Removed webpack configuration in favor of Vite
## Development Environment
- Created new development startup script (dev.sh)
- Updated frontend environment variables
- Configured HMR (Hot Module Replacement) for better development experience
- Set up proper proxy configuration for API and media files
## Configuration Updates
- Updated Django settings to work with Vite development server
- Added proper CORS and CSRF configurations for development
- Improved authentication backend configuration
## How to Run Development Environment
1. Ensure PostgreSQL is running and database is created
2. Set up your ***REMOVED*** file with necessary environment variables
3. Run migrations: `python manage.py migrate`
4. Install frontend dependencies: `cd frontend && npm install`
5. Start development servers: `./dev.sh`
The development environment will start both Django (port 8000) and Vite (port 5173) servers and open the application in your default browser.
## Next Steps
- Set up Netlify configuration for frontend deployment
- Configure production environment variables
- Set up CI/CD pipeline

View File

@@ -0,0 +1,143 @@
# Frontend Setup - February 14, 2024
## Technology Stack
### Core Technologies
- React 18.2.0
- TypeScript 5.2.2
- Material UI 5.14.17
- React Router 6.18.0
### Build Tools
- Webpack 5.89.0
- Babel 7.23.2
- CSS Loader 6.8.1
- Style Loader 3.3.3
### Development Tools
- Webpack Dev Server 4.15.1
- React Refresh Webpack Plugin 0.5.11
- TypeScript Compiler
- ESLint
## Features Implemented
### Core Features
1. Authentication
- Login/Register pages
- Social authentication support
- Protected routes
- User role management
2. Theme System
- Dark/Light mode toggle
- System preference detection
- Theme persistence
- Custom Material UI theme
3. Navigation
- Responsive navbar
- Mobile hamburger menu
- Search functionality
- User menu
4. Park Management
- Park listing with filters
- Park details page
- Ride listing
- Ride details page
5. User Features
- Profile pages
- Ride credits tracking
- Review system
- Photo uploads
### Technical Features
1. Performance
- Code splitting with React.lazy()
- Route-based chunking
- Image optimization
- Webpack optimization
2. Type Safety
- Full TypeScript integration
- Type-safe API calls
- Interface definitions
- Strict type checking
3. State Management
- React hooks
- Context API
- Local storage integration
- Form state management
4. UI/UX
- Responsive design
- Loading states
- Error boundaries
- Toast notifications
## Project Structure
```
frontend/
├── src/
│ ├── components/ # Reusable UI components
│ ├── pages/ # Route components
│ ├── hooks/ # Custom React hooks
│ ├── api/ # API client and utilities
│ ├── types/ # TypeScript definitions
│ └── utils/ # Helper functions
├── public/ # Static assets
└── webpack.config.js # Build configuration
```
## Development Workflow
1. Start Development Server:
```bash
npm start
```
2. Build for Production:
```bash
npm run build
```
3. Type Checking:
```bash
npm run type-check
```
4. Linting:
```bash
npm run lint
```
## Next Steps
1. Implement Edit System
- Inline editing for parks/rides
- Edit history tracking
- Moderation workflow
2. Review System
- Review submission
- Rating system
- Review moderation
3. Photo Management
- Photo upload
- Gallery system
- Photo moderation
4. Admin Interface
- User management
- Content moderation
- Statistics dashboard
5. Testing
- Unit tests
- Integration tests
- End-to-end tests

View File

@@ -0,0 +1,78 @@
# ThrillWiki Initial Setup
## Project Overview
ThrillWiki is a database website focused on rides and attractions in the amusement and theme park industries. The site features detailed statistics, photos, and user reviews for parks and rides worldwide.
## Technical Stack
- Backend: Django 5.1.2
- Frontend: React + Material UI + Alpine.js + HTMX
- Database: PostgreSQL
- Authentication: django-allauth (with Discord and Google OAuth support)
- Email: ForwardEmail.net SMTP
## Key Features
- Full authentication system with social login support
- Responsive design for desktop and mobile
- Light/dark theme support
- Rich media support for ride and park photos
- User review system with average ratings
- Inline editing for authenticated users
- Page history tracking
- Advanced search and filtering capabilities
## Project Structure
```
thrillwiki/
├── accounts/ # User authentication and profiles
├── api/ # REST API endpoints
├── docs/ # Project documentation
├── frontend/ # React frontend application
├── media/ # User-uploaded content
├── parks/ # Park-related models and views
├── reviews/ # User reviews functionality
├── rides/ # Ride-related models and views
├── static/ # Static assets
├── templates/ # Django templates
└── thrillwiki/ # Project settings and core configuration
```
## Setup Instructions
1. Create and activate a virtual environment:
```bash
python -m venv venv
source venv/bin/activate
```
2. Install dependencies:
```bash
pip install -r requirements.txt
```
3. Configure environment variables:
- Copy ***REMOVED***.example to ***REMOVED***
- Update the variables with your specific values
4. Set up the database:
```bash
python manage.py migrate
```
5. Create a superuser:
```bash
python manage.py createsuperuser
```
6. Run the development server:
```bash
python manage.py runserver
```
## Next Steps
- [ ] Implement user models and authentication views
- [ ] Create park and ride models
- [ ] Set up review system
- [ ] Implement frontend components
- [ ] Configure social authentication
- [ ] Set up email verification
- [ ] Implement search and filtering
- [ ] Add media handling