File size: 5,273 Bytes
25f22bf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3c6e0b2
25f22bf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2a7e4f1
25f22bf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2a7e4f1
 
 
25f22bf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2a7e4f1
25f22bf
 
3c6e0b2
 
 
 
 
 
 
25f22bf
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# Lin - Community Manager Assistant for LinkedIn

## Project Overview

Lin is a comprehensive community management tool designed to help users automate and streamline their LinkedIn activities. The project follows a modern full-stack architecture with:

- **Frontend**: React application with Vite build system, utilizing Tailwind CSS for styling and Redux for state management
- **Backend**: Flask-based REST API with SQLAlchemy for database operations and Supabase for authentication
- **Key Features**: LinkedIn OAuth integration, content scheduling, post management, and analytics

## Project Structure

```
Lin/
β”œβ”€β”€ package.json              # Root package.json with combined scripts
β”œβ”€β”€ frontend/                 # React frontend application
β”‚   β”œβ”€β”€ package.json          # Frontend-specific dependencies
β”‚   β”œβ”€β”€ src/                  # React source code
β”‚   β”œβ”€β”€ public/               # Static assets
β”‚   └── build/                # Build output
β”œβ”€β”€ backend/                  # Flask backend API
β”‚   β”œβ”€β”€ app.py                # Main application file
β”‚   β”œβ”€β”€ requirements.txt      # Python dependencies
β”‚   β”œβ”€β”€ api/                  # API endpoints
β”‚   β”œβ”€β”€ models/               # Data models
β”‚   β”œβ”€β”€ scheduler/            # APScheduler service
β”‚   β”œβ”€β”€ services/             # Business logic
β”‚   └── utils/                # Utility functions
└── README.md                 # Project documentation
```

## Building and Running

### Prerequisites

- Node.js (v16 or higher)
- Python (v3.8 or higher)
- npm (v8 or higher)

### Installation

**Option 1: Using the root package.json (Recommended)**

```bash
# Install all dependencies
npm install

# Setup the project
npm run setup

# Start both frontend and backend
npm start
```

**Option 2: Manual installation**

```bash
# Install frontend dependencies
cd frontend
npm install

# Install backend dependencies
cd ../backend
pip install -r requirements.txt
```

### Development Servers

- `npm run dev:frontend` - Start frontend development server
- `npm run dev:backend` - Start backend development server
- `npm run dev:all` - Start both servers concurrently
- `npm start` - Alias for `npm run dev:all`

### Build & Test

- `npm run build` - Build frontend for production
- `npm run preview` - Preview production build
- `npm run test` - Run frontend tests
- `npm run test:backend` - Run backend tests
- `npm run lint` - Run ESLint
- `npm run lint:fix` - Fix ESLint issues

## Development Conventions

### Frontend

- Built with React and Vite
- Uses Tailwind CSS for styling
- Implements Redux for state management
- Follows responsive design principles with mobile-first approach
- Uses React Router for navigation
- Implements proper error boundaries and loading states

### Backend

- Built with Flask
- Uses Supabase for authentication and database
- Implements JWT for token-based authentication
- Uses SQLAlchemy for database operations
- Uses APScheduler for task scheduling
- Follows REST API design principles

### UI Components

The application features several key UI components:

1. **Header**: Contains the application logo and user profile/logout functionality
2. **Sidebar**: Navigation menu with links to different sections of the app
3. **Responsive Design**: Adapts to different screen sizes with special handling for mobile devices

### Key Features

1. **Authentication**: Login and registration functionality with JWT tokens
2. **LinkedIn Integration**: OAuth integration for connecting LinkedIn accounts
3. **Content Management**: Create, edit, and schedule posts
4. **Automated Scheduling**: Uses APScheduler for reliable task scheduling
5. **Analytics**: Dashboard with overview and analytics
6. **Responsive UI**: Mobile-friendly design with optimized touch interactions

## Environment Setup

### Frontend Environment

```bash
# Copy environment file
cd frontend
cp .env.example .env.local

# Edit environment variables
# Open .env.local and add your required values
```

**Required Frontend Variables**:
- `REACT_APP_API_URL` - Backend API URL (default: http://localhost:5000)

### Backend Environment

```bash
# Copy environment file
cd backend
cp .env.example .env

# Edit environment variables
# Open .env and add your required values
```

**Required Backend Variables**:
- `SUPABASE_URL` - Your Supabase project URL
- `SUPABASE_KEY` - Your Supabase API key
- `CLIENT_ID` - LinkedIn OAuth client ID
- `CLIENT_SECRET` - LinkedIn OAuth client secret
- `REDIRECT_URL` - LinkedIn OAuth redirect URL
- `HUGGING_KEY` - Hugging Face API key
- `JWT_SECRET_KEY` - Secret key for JWT token generation
- `SECRET_KEY` - Flask secret key
- `DEBUG` - Debug mode (True/False)
- `SCHEDULER_ENABLED` - Enable/disable APScheduler (True/False)
- `PORT` - Port to run the application on (default: 5000)

## Scheduler Documentation

For detailed information about the APScheduler implementation, see:
- `APSCHEDULER_SETUP.md` - Complete setup and usage guide
- `MIGRATION_TO_APSCHEDULER.md` - Migration guide from Celery
- `APSCHEDULER_IMPLEMENTATION_SUMMARY.md` - Technical implementation summary

## Development URLs

- **Frontend**: http://localhost:3000
- **Backend API**: http://localhost:5000