Files
Filamenteka/PROJECT_STRUCTURE.md
DaX b97032bf0c Clean up obsolete resources and update documentation
- Remove all DynamoDB-related scripts and data files
- Remove AWS SDK dependencies from scripts
- Update environment files to remove DynamoDB/Lambda references
- Update PROJECT_STRUCTURE.md to reflect current architecture
- Clean up Terraform variables and examples
- Add PLA Matte to special pricing (3999 RSD / 3499 RSD refill)
- Make all table columns sortable
- Remove old Terraform state backups
- Remove temporary data import files
2025-06-20 16:30:10 +02:00

126 lines
3.8 KiB
Markdown

# Project Structure
## Overview
Filamenteka is organized with clear separation between frontend, API, and infrastructure code.
## Directory Structure
```
filamenteka/
├── app/ # Next.js app directory
│ ├── page.tsx # Main page
│ ├── layout.tsx # Root layout
│ └── upadaj/ # Admin pages
│ ├── page.tsx # Admin login
│ ├── dashboard/ # Filament management
│ └── colors/ # Color management
├── src/ # Source code
│ ├── components/ # React components
│ │ ├── FilamentTableV2.tsx
│ │ ├── EnhancedFilters.tsx
│ │ ├── ColorSwatch.tsx
│ │ ├── InventoryBadge.tsx
│ │ └── MaterialBadge.tsx
│ ├── types/ # TypeScript types
│ │ ├── filament.ts
│ │ └── filament.v2.ts
│ ├── services/ # API services
│ │ └── api.ts
│ └── styles/ # Component styles
│ ├── index.css
│ └── select.css
├── api/ # Node.js Express API
│ ├── server.js # Express server
│ ├── migrate.js # Database migration script
│ ├── package.json # API dependencies
│ └── Dockerfile # Docker configuration
├── database/ # Database schemas
│ └── schema.sql # PostgreSQL schema
├── terraform/ # Infrastructure as Code
│ ├── main.tf # Main configuration
│ ├── vpc.tf # VPC and networking
│ ├── rds.tf # PostgreSQL RDS
│ ├── ec2-api.tf # EC2 for API server
│ ├── alb.tf # Application Load Balancer
│ ├── ecr.tf # Docker registry
│ ├── cloudflare-api.tf # Cloudflare DNS
│ └── variables.tf # Variable definitions
├── scripts/ # Utility scripts
│ ├── security/ # Security checks
│ │ └── security-check.js
│ └── pre-commit.sh # Git pre-commit hook
├── config/ # Configuration files
│ └── environments.js # Environment configuration
└── public/ # Static assets
```
## Environment Files
- `.env.development` - Development environment variables
- `.env.production` - Production environment variables
- `.env.local` - Local overrides (not committed)
## Key Concepts
### Architecture
- **Frontend**: Next.js static site hosted on AWS Amplify
- **API**: Node.js Express server running on EC2
- **Database**: PostgreSQL on AWS RDS
- **HTTPS**: Application Load Balancer with ACM certificate
### Data Flow
1. Frontend (Next.js) → HTTPS API (ALB) → Express Server (EC2) → PostgreSQL (RDS)
2. Authentication via JWT tokens
3. Real-time database synchronization
### Infrastructure
- Managed via Terraform
- AWS services: RDS, EC2, ALB, VPC, ECR, Amplify
- Cloudflare for DNS management
- Docker for API containerization
## Development Workflow
1. **Local Development**
```bash
npm run dev
```
2. **Deploy Infrastructure**
```bash
cd terraform
terraform apply
```
3. **Deploy API Updates**
- API automatically pulls latest Docker image every 5 minutes
- Or manually: SSH to EC2 and run deployment script
## Database Management
### Run Migrations
```bash
cd api
npm run migrate
```
### Connect to Database
```bash
psql postgresql://user:pass@rds-endpoint/filamenteka
```
## Security
- No hardcoded credentials
- JWT authentication for admin
- Environment-specific configurations
- Pre-commit security checks
- HTTPS everywhere
- VPC isolation for backend services