- Import real data from PDF (35 Bambu Lab filaments) - Remove all Confluence integration and dependencies - Implement new V2 data structure with proper inventory tracking - Add backwards compatibility for existing data - Create enhanced UI components (ColorSwatch, InventoryBadge, MaterialBadge) - Add advanced filtering with quick filters and multi-criteria search - Organize codebase for dev/prod environments - Update Lambda functions to support both V1/V2 formats - Add inventory summary dashboard - Clean up project structure and documentation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
121 lines
3.7 KiB
Markdown
121 lines
3.7 KiB
Markdown
# Project Structure
|
|
|
|
## Overview
|
|
Filamenteka is organized with clear separation between environments, infrastructure, and application code.
|
|
|
|
## Directory Structure
|
|
|
|
```
|
|
filamenteka/
|
|
├── app/ # Next.js app directory
|
|
│ ├── page.tsx # Main page
|
|
│ ├── layout.tsx # Root layout
|
|
│ ├── admin/ # Admin pages
|
|
│ │ ├── page.tsx # Admin login
|
|
│ │ └── dashboard/ # Admin dashboard
|
|
│ └── globals.css # Global styles
|
|
│
|
|
├── src/ # Source code
|
|
│ ├── components/ # React components
|
|
│ │ ├── FilamentTable.tsx
|
|
│ │ ├── FilamentForm.tsx
|
|
│ │ └── ColorCell.tsx
|
|
│ ├── types/ # TypeScript types
|
|
│ │ └── filament.ts
|
|
│ ├── data/ # Data and utilities
|
|
│ │ └── bambuLabColors.ts
|
|
│ └── styles/ # Component styles
|
|
│ └── select.css
|
|
│
|
|
├── lambda/ # AWS Lambda functions
|
|
│ ├── filaments/ # Filaments CRUD API
|
|
│ │ ├── index.js
|
|
│ │ └── package.json
|
|
│ └── auth/ # Authentication API
|
|
│ ├── index.js
|
|
│ └── package.json
|
|
│
|
|
├── terraform/ # Infrastructure as Code
|
|
│ ├── environments/ # Environment-specific configs
|
|
│ │ ├── dev/
|
|
│ │ └── prod/
|
|
│ ├── main.tf # Main Terraform configuration
|
|
│ ├── dynamodb.tf # DynamoDB tables
|
|
│ ├── lambda.tf # Lambda functions
|
|
│ ├── api_gateway.tf # API Gateway
|
|
│ └── variables.tf # Variable definitions
|
|
│
|
|
├── scripts/ # Utility scripts
|
|
│ ├── data-import/ # Data import tools
|
|
│ │ ├── import-pdf-data.js
|
|
│ │ └── clear-dynamo.js
|
|
│ ├── security/ # Security checks
|
|
│ │ └── security-check.js
|
|
│ └── build/ # Build scripts
|
|
│
|
|
├── 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)
|
|
- `.env.development.local` - Local dev overrides (not committed)
|
|
|
|
## Key Concepts
|
|
|
|
### Environments
|
|
- **Development**: Uses `dev` API Gateway stage and separate DynamoDB table
|
|
- **Production**: Uses `production` API Gateway stage and main DynamoDB table
|
|
|
|
### Data Flow
|
|
1. Frontend (Next.js) → API Gateway → Lambda Functions → DynamoDB
|
|
2. Authentication via JWT tokens stored in localStorage
|
|
3. Real-time data updates every 5 minutes
|
|
|
|
### Infrastructure
|
|
- Managed via Terraform
|
|
- Separate resources for dev/prod
|
|
- AWS services: DynamoDB, Lambda, API Gateway, Amplify
|
|
|
|
## Development Workflow
|
|
|
|
1. **Local Development**
|
|
```bash
|
|
npm run dev
|
|
```
|
|
|
|
2. **Deploy to Dev**
|
|
```bash
|
|
cd terraform
|
|
terraform apply -var-file=environments/dev/terraform.tfvars
|
|
```
|
|
|
|
3. **Deploy to Production**
|
|
```bash
|
|
cd terraform
|
|
terraform apply -var-file=environments/prod/terraform.tfvars
|
|
```
|
|
|
|
## Data Management
|
|
|
|
### Import Data from PDF
|
|
```bash
|
|
node scripts/data-import/import-pdf-data.js
|
|
```
|
|
|
|
### Clear DynamoDB Table
|
|
```bash
|
|
node scripts/data-import/clear-dynamo.js
|
|
```
|
|
|
|
## Security
|
|
|
|
- No hardcoded credentials
|
|
- JWT authentication for admin
|
|
- Environment-specific configurations
|
|
- Pre-commit security checks |