gucci
This commit is contained in:
64
README.md
64
README.md
@@ -1,36 +1,48 @@
|
||||
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
|
||||
## Cloudflare R2 File Drive
|
||||
|
||||
## Getting Started
|
||||
|
||||
First, run the development server:
|
||||
A simple FTP-style web UI built with Next.js App Router. Users can register/login (email + password), upload files or entire folders, list them, download via signed URLs, and delete. Files are stored in Cloudflare R2 (S3-compatible); metadata and users are stored in SQLite via Prisma.
|
||||
|
||||
## Setup
|
||||
1) Install deps (already checked in `package-lock.json`):
|
||||
```bash
|
||||
npm run dev
|
||||
# or
|
||||
yarn dev
|
||||
# or
|
||||
pnpm dev
|
||||
# or
|
||||
bun dev
|
||||
npm install
|
||||
```
|
||||
|
||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
||||
2) Copy `env.example` to `.env.local` (or set env vars another way) and fill:
|
||||
- `DATABASE_URL="file:./dev.db"` (default SQLite)
|
||||
- `R2_ENDPOINT="https://<account-id>.r2.cloudflarestorage.com"`
|
||||
- `R2_REGION="auto"`
|
||||
- `R2_ACCESS_KEY_ID`, `R2_SECRET_ACCESS_KEY`
|
||||
- `R2_BUCKET`
|
||||
- `JWT_SECRET` (long random string)
|
||||
- `PORT` / `NEXT_PORT` (defaults set to 4000 to avoid 3000)
|
||||
|
||||
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
|
||||
3) Create DB & Prisma client:
|
||||
```bash
|
||||
npx prisma db push
|
||||
npx prisma generate
|
||||
```
|
||||
|
||||
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
|
||||
4) Run dev server on port 4000:
|
||||
```bash
|
||||
npm run dev
|
||||
# overrides: PORT=4500 npm run dev
|
||||
```
|
||||
|
||||
## Learn More
|
||||
5) Production:
|
||||
```bash
|
||||
npm run build
|
||||
PORT=4000 npm run start
|
||||
```
|
||||
|
||||
To learn more about Next.js, take a look at the following resources:
|
||||
## Usage
|
||||
- Register or log in at `/register` or `/login`.
|
||||
- Dashboard at `/dashboard`:
|
||||
- Upload files or folders (uses `webkitdirectory`; folder structure is preserved in keys).
|
||||
- Files are stored under a user-specific prefix in R2; metadata kept in SQLite.
|
||||
- Download uses short-lived signed URLs; delete removes from R2 and DB.
|
||||
|
||||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
||||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
||||
|
||||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
|
||||
|
||||
## Deploy on Vercel
|
||||
|
||||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
||||
|
||||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
|
||||
## Notes
|
||||
- Middleware protects `/dashboard` and `/api/files/*`; auth cookie is HttpOnly JWT.
|
||||
- To change ports, set `PORT`/`NEXT_PORT` or pass `-p` to scripts; defaults avoid 3000.
|
||||
- R2 endpoint format: `https://<account-id>.r2.cloudflarestorage.com`.
|
||||
|
||||
Reference in New Issue
Block a user