Skip to content

Commit dc7a80a

Browse files
committed
payments and policies
1 parent d4df7a9 commit dc7a80a

26 files changed

Lines changed: 2447 additions & 733 deletions

File tree

README.md

Lines changed: 67 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
# CandyShare
22

3-
A simple file-sharing platform that lets you upload files and generate secure temporary links for sharing. Perfect for quickly sharing files without the need for accounts or complex setup.
3+
A modern file-sharing platform that lets you upload files and generate secure temporary links for sharing. Perfect for quickly sharing files with advanced features and multiple tier options.
44

55
## What it does
66

77
CandyShare allows you to:
88

9-
- **Upload files** of any type and size
9+
- **Upload files** with drag-and-drop interface
1010
- **Generate secure links** that expire automatically
11-
- **Share files instantly** with anyone via a simple URL
11+
- **Share files instantly** with anyone via a simple URL or QR code
1212
- **Protect sensitive files** with optional password protection
13-
- **Track downloads** and access patterns
14-
- **No registration required** - start sharing immediately
13+
- **Track downloads** and access patterns with detailed analytics
14+
- **Choose your tier** - Anonymous, Free, or Pro sharing options
15+
- **Manage files** with a comprehensive dashboard
1516

1617
## Use Cases
1718

@@ -44,6 +45,10 @@ CandyShare allows you to:
4445
- **Password Protection**: Add passwords to sensitive files
4546
- **QR Code Sharing**: Generate QR codes for easy mobile sharing
4647
- **Download Tracking**: See how many times files are downloaded
48+
- **Analytics Dashboard**: Detailed insights into file usage and activity
49+
- **User Authentication**: Secure account management with NextAuth
50+
- **Payment Integration**: Pro tier subscription with Razorpay
51+
- **File Management**: Organize and manage your shared files
4752
- **Multiple Tiers**: Anonymous, Free, and Pro sharing options
4853

4954
## Quick Start
@@ -66,15 +71,18 @@ CandyShare allows you to:
6671

6772
- Account required
6873
- Files expire in 7 days
69-
- Up to 100MB file size
74+
- Up to 200MB file size
7075
- Password protection available
76+
- Basic analytics
7177

72-
### Pro
78+
### Pro ($8.99/month)
7379

7480
- Full features
7581
- Files expire in 30 days
76-
- Up to 1GB file size
77-
- Advanced analytics and customization
82+
- Up to 2GB file size
83+
- Advanced analytics and insights
84+
- Priority support
85+
- Custom branding options
7886

7987
## Getting Started
8088

@@ -83,6 +91,7 @@ CandyShare allows you to:
8391
- Node.js 18+ or Bun
8492
- PostgreSQL database
8593
- AWS S3 bucket
94+
- Razorpay account (for payments)
8695

8796
### Installation
8897

@@ -93,43 +102,85 @@ git clone https://github.com/yourusername/candyshare.git
93102
cd candyshare
94103
```
95104

96-
2. Install dependencies
105+
2. Install backend dependencies
97106

98107
```bash
99108
cd backend
100109
bun install
101110
```
102111

103-
3. Set up environment variables
112+
3. Install frontend dependencies
104113

114+
```bash
115+
cd ../frontend
116+
npm install
117+
```
118+
119+
4. Set up environment variables
120+
121+
**Backend (.env):**
105122
```bash
106123
cp .env.example .env
107-
# Edit .env with your database and AWS credentials
124+
# Edit .env with your database, AWS, and Razorpay credentials
108125
```
109126

110-
4. Run database migrations
127+
**Frontend (.env.local):**
128+
```bash
129+
cp .env.example .env.local
130+
# Edit .env.local with your API endpoints
131+
```
132+
133+
5. Run database migrations
111134

112135
```bash
136+
cd backend
113137
bun run db:generate
138+
bun run db:migrate
114139
```
115140

116-
5. Start the development server
141+
6. Start the development servers
117142

143+
**Backend:**
118144
```bash
145+
cd backend
119146
bun run dev
120147
```
121148

149+
**Frontend:**
150+
```bash
151+
cd frontend
152+
npm run dev
153+
```
154+
122155
The application will be available at `http://localhost:3000`.
123156

124157
## Docker Deployment
125158

126159
Build and run with Docker:
127160

128161
```bash
129-
docker build -t candyshare .
130-
docker run -p 3000:3000 candyshare
162+
docker build -f docker/Dockerfile.server -t candyshare .
163+
docker run -p 4000:4000 candyshare
131164
```
132165

166+
## Project Structure
167+
168+
```
169+
CandyShare/
170+
├── backend/ # Bun + Prisma API server
171+
├── frontend/ # Next.js React application
172+
├── docker/ # Docker configuration
173+
└── README.md
174+
```
175+
176+
## Legal Pages
177+
178+
- [Privacy Policy](/privacy-policy)
179+
- [Terms & Conditions](/terms-conditions)
180+
- [Pricing Policy](/pricing-policy)
181+
- [Refund Policy](/refund-policy)
182+
- [Shipping Policy](/shipping-policy)
183+
133184
## Contributing
134185

135186
Contributions are welcome! Please feel free to submit a Pull Request.

backend/.env.example

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,7 @@ DATABASE_URL="postgresql://postgres:mysecretpassword@localhost:5432/postgres"
1313
AWS_ACCESS_KEY_ID=
1414
AWS_SECRET_ACCESS_KEY=
1515
AWS_BUCKET_NAME=
16-
AWS_REGION=
16+
AWS_REGION=
17+
18+
RAZORPAY_KEY_ID=
19+
RAZORPAY_KEY_SECRET=

backend/README.md

Lines changed: 93 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,103 @@
1-
# backend
1+
# CandyShare Backend
22

3-
To install dependencies:
3+
The backend API server for CandyShare, built with Bun, Prisma, and PostgreSQL.
4+
5+
## Features
6+
7+
- **File Upload/Download**: Secure file handling with AWS S3
8+
- **User Authentication**: JWT-based auth with NextAuth integration
9+
- **Payment Processing**: Razorpay integration for Pro subscriptions
10+
- **Analytics**: File usage tracking and statistics
11+
- **Database**: PostgreSQL with Prisma ORM
12+
- **API**: RESTful API with TypeScript
13+
14+
## Prerequisites
15+
16+
- Bun runtime
17+
- PostgreSQL database
18+
- AWS S3 bucket
19+
- Razorpay account
20+
21+
## Installation
22+
23+
1. Install dependencies:
424

525
```bash
626
bun install
727
```
828

9-
To run:
29+
2. Set up environment variables:
30+
31+
```bash
32+
cp .env.example .env
33+
```
34+
35+
Required environment variables:
36+
```env
37+
DATABASE_URL="postgresql://username:password@localhost:5432/candyshare"
38+
AWS_ACCESS_KEY_ID="your_aws_access_key"
39+
AWS_SECRET_ACCESS_KEY="your_aws_secret_key"
40+
AWS_BUCKET_NAME="your_s3_bucket"
41+
RAZORPAY_KEY_ID="your_razorpay_key_id"
42+
RAZORPAY_KEY_SECRET="your_razorpay_key_secret"
43+
JWT_SECRET="your_jwt_secret"
44+
NEXTAUTH_SECRET="your_nextauth_secret"
45+
NEXTAUTH_URL="http://localhost:3000"
46+
```
47+
48+
3. Generate Prisma client:
49+
50+
```bash
51+
bun run db:generate
52+
```
53+
54+
4. Run database migrations:
1055

1156
```bash
12-
bun run index.ts
57+
bun run db:migrate
1358
```
1459

15-
This project was created using `bun init` in bun v1.2.20. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime.
60+
5. Seed the database (optional):
61+
62+
```bash
63+
bun run db:seed
64+
```
65+
66+
## Development
67+
68+
Start the development server:
69+
70+
```bash
71+
bun run dev
72+
```
73+
74+
The API will be available at `http://localhost:4000`.
75+
76+
## API Endpoints
77+
78+
- `GET /health` - Health check
79+
- `POST /api/auth/register` - User registration
80+
- `POST /api/auth/login` - User login
81+
- `POST /api/files/upload` - File upload
82+
- `GET /api/files/:id` - File download
83+
- `GET /api/files` - User files list
84+
- `POST /api/payment/create-order` - Create payment order
85+
- `POST /api/payment/verify-payment` - Verify payment
86+
- `GET /api/analytics` - User analytics
87+
88+
## Database Schema
89+
90+
The database includes tables for:
91+
- Users and authentication
92+
- File metadata and storage
93+
- Payment and subscription tracking
94+
- Analytics and usage statistics
95+
96+
## Scripts
97+
98+
- `bun run dev` - Start development server
99+
- `bun run build` - Build for production
100+
- `bun run start` - Start production server
101+
- `bun run db:generate` - Generate Prisma client
102+
- `bun run db:migrate` - Run database migrations
103+
- `bun run db:seed` - Seed database with test data

backend/bun.lock

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import express, { type NextFunction, type Request, type Response } from "express
22
import cors from "cors"
33
import handleFile from "./routes/handleFile";
44
import authRoutes from "./routes/auth";
5+
import paymentRoutes from "./routes/payment";
56
import morgan from "morgan";
67
import { rateLimit } from "express-rate-limit";
78

@@ -56,6 +57,7 @@ app.use((req: Request, res: Response, next: NextFunction) => {
5657

5758
app.use("/api/file", handleFile);
5859
app.use("/api/auth", authRoutes);
60+
app.use("/api/payment", paymentRoutes);
5961

6062
app.get('/health', (req, res) => {
6163
res.status(200).json({

0 commit comments

Comments
 (0)