https://github.com/in-c0/autocensor-backend
https://github.com/in-c0/autocensor-backend
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/in-c0/autocensor-backend
- Owner: in-c0
- Created: 2025-02-10T06:25:02.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-04-02T16:11:01.000Z (about 2 months ago)
- Last Synced: 2025-04-02T16:23:51.727Z (about 2 months ago)
- Language: JavaScript
- Size: 107 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Overview
backend for AutoCensor using Deepgram for transcription and FFMPEG.wasm for in‐browser video editing. We use Wasp-Lang as our full‐stack DSL
Check Deployment Status with:
```bash
flyctl status
```Run server locally:
```bash
node server/index.js
```Configure TLS version >1.2:
```bash
$env:NODE_OPTIONS="--tls-min-v1.2"
```Configure .env variables:
```bash
NODE_ENV=development
PORT=3000
FRONTEND_URL=http://localhost:3000
MONGO_URI=mongodb+srv://:@cluster0.mongodb.net/?retryWrites=true&w=majority
SESSION_SECRET=your-session-secret
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
GOOGLE_CALLBACK_URL=http://localhost:3000/auth/google/callback
AWS_ACCESS_KEY_ID=your_access_key_id
AWS_SECRET_ACCESS_KEY=your_secret_access_key
AWS_REGION=your_aws_region
S3_BUCKET=your_s3_bucket
STRIPE_SECRET_KEY=your_stripe_secret_key
```
For local testing of MongoDB TLS issues, the code appends `tlsAllowInvalidCertificates=true` to the connection string automatically if not in production.## Testing Endpoints
### auth/google:
In your browser, visit http://localhost:3000/auth/google.
After successful authentication, you should be redirected to http://localhost:3000 (or your configured FRONTEND_URL) and receive a session cookie (connect.sid).
Check your browser’s Developer Tools under Application → Cookies to confirm that the session cookie is set.### files/upload-url
Using Postman, send a POST request to:
```bash
http://localhost:3000/api/files/upload-url
```
with a raw JSON body:
```json
{
"fileName": "sample.mp4",
"fileType": "video/mp4"
}
```
The response will contain a `url` (presigned URL) and a `key` (S3 object key).
Using the returned presigned URL, create a PUT request in Postman:
- Set the URL to the presigned URL from the response.
- In the Headers tab, set Content-Type to video/mp4.
- In the Body tab, select binary and choose the file (sample.mp4) from your system.
- Send the request. A 200 OK response indicates the file was successfully uploaded. You can verify this in your S3 console.### api/analyze
With an authenticated session (include the session cookie if testing via Postman), send a POST request to:
```bash
http://localhost:3000/api/analyze
```
with a JSON body:
```json
{
"fileKey": "uploads/your-uploaded-file-key",
"fileUrl": "https://your-s3-bucket.s3.amazonaws.com/uploads/your-uploaded-file-key"
}
```Retrieve the session cookie from your browser’s Developer Tools (under Application → Cookies).
Then, in Postman, add this cookie to your request by adding it in the header key: 'Cookie' and value: 'connect.sid=...'TODO:
Remember to configure S3 bucket with a lifecycle policy to delete objects after 24 hours