--- ๐ Attached 1 file(s):
File: pasted-code-1787458887039.txt
Build the entire project from scratch.
The application is a Discord bot called **RoGrabber** that lets authorized users request an export of a Roblox experience they own or are explicitly permitted to export.
Do not assume any existing code exists.
# COMPLETE ARCHITECTURE
Build all components:
/decomp <Place ID>
๐
pasted-code-1787458919959.txt
txt
723 lines
โถ
Build the entire project from scratch.
The application is a Discord bot called **RoGrabber** that lets authorized users request an export of a Roblox experience they own or are explicitly permitted to export.
Do not assume any existing code exists.
# COMPLETE ARCHITECTURE
Build all components:
```text
Discord Bot
โ
Job Manager
โ
Authorized Roblox Export Worker
โ
Roblox Place Export
โ
Streaming Transfer
โ
Backend
โ
GoFile
โ
Discord Download Link
```
The user should ultimately be able to run:
```text
/decomp
```
and receive the resulting GoFile link after a successful authorized export.
# IMPORTANT AUTHORIZATION REQUIREMENT
The system must only export experiences the requesting user owns or has explicit authorization to export.
Do not implement:
* Roblox password collection
* `.ROBLOSECURITY`
* credential theft
* authentication bypasses
* anti-cheat bypasses
* unauthorized game extraction
* executor distribution
* arbitrary third-party game dumping
Do not claim that Roblox provides an official API for downloading arbitrary places as `.rbxl`.
# 1. DISCORD BOT
Use:
* Node.js 20+
* discord.js v14+
* TypeScript preferred
* dotenv
Create slash commands:
```text
/decomp
/status
/cancel
/retry
/about
```
## `/decomp`
Accept:
```text
place_id
```
Example:
```text
/decomp place_id:6403373529
```
Create a unique job ID.
Example:
```text
JOB-80FED389
```
Reply:
```text
๐ Roblox Export
Place ID:
6403373529
Job:
JOB-80FED389
Status:
Starting...
```
# 2. DATABASE
Use SQLite by default.
Create:
### jobs
```text
id
discord_user_id
guild_id
place_id
status
file_name
file_size
sha256
gofile_url
error
created_at
started_at
completed_at
worker_id
```
### workers
```text
id
name
version
status
last_heartbeat
current_job
```
### authorized_users
```text
discord_user_id
enabled
created_at
```
# 3. JOB STATES
Use:
```text
queued
authorizing
waiting_for_worker
exporting
streaming
uploading
completed
failed
cancelled
```
All state changes must be persisted.
# 4. ROBLOX METADATA
When a Place ID is entered, retrieve public metadata where available:
* Place name
* Universe ID
* Creator
* Thumbnail
Display it in the Discord embed.
Do not require Roblox credentials for public metadata.
# 5. AUTHORIZED ROBLOX WORKER
Build a separate worker application from scratch.
It runs independently from the Discord bot.
Configuration:
```env
BACKEND_URL=
EXPORT_CLIENT_SECRET=
WORKER_ID=
WORKER_NAME=
```
The worker authenticates using:
```http
x-client-secret:
```
Never expose the secret to Discord users.
# 6. WORKER HEARTBEAT
Every 15 seconds send:
```http
POST /worker/heartbeat
```
Body:
```json
{
"workerId": "...",
"workerName": "...",
"version": "1.0.0",
"status": "idle"
}
```
If a heartbeat is missed for more than 45 seconds, mark the worker offline.
# 7. JOB CLAIMING
Worker requests:
```http
GET /worker/jobs/next
```
If a job exists:
```json
{
"jobId": "JOB-80FED389",
"placeId": "6403373529"
}
```
Worker claims:
```http
POST /worker/jobs/JOB-80FED389/claim
```
Job claiming must be atomic.
Never allow two workers to process the same job.
# 8. EXPORTER INTERFACE
Create a clean abstraction:
```ts
interface RobloxExporter {
authorize(placeId: string): Promise;
exportPlace(
placeId: string
): Promise<{
fileName: string;
contentType: string;
size?: number;
stream: NodeJS.ReadableStream;
}>;
disconnect(): Promise;
}
```
The exporter must be implemented as a separate adapter.
Do not pretend an unavailable Roblox API exists.
# 9. EXPORT MECHANISM
For experiences the user owns or is authorized to export, implement the exporter using an actual supported Roblox workflow.
If Universal Syn Save Instance is being used in the authorized environment, inspect its current public repository/documentation before writing the adapter:
```text
https://github.com/luau/UniversalSynSaveInstance
```
Do not invent functions.
Do not turn USSI into a fake Node package.
If the chosen authorized export environment cannot automatically produce the requested place, return a clear configuration error rather than a fake file.
# 10. ZERO-DISK TRANSFER
Do not require:
```text
C:\RobloxExports
```
Do not require manual file copying.
Do not require the user to rename files.
Where technically supported, the exporter should provide the result as a stream.
Pipeline:
```text
Roblox Export
โ
Readable Stream
โ
SHA-256 transform
โ
Backend HTTP stream
```
Do not load a large place entirely into RAM.
Do not create unnecessary persistent temporary files.
# 11. BACKEND FILE ENDPOINT
Create:
```http
POST /jobs/:jobId/file
```
Require:
```http
x-client-secret
```
Accept streaming multipart uploads.
Metadata:
```text
filename
contentType
size
sha256
```
Validate:
* non-zero size
* maximum size
* `.rbxl` / `.rbxlx`
* complete stream
* checksum
# 12. GOFILE SERVICE
Create a dedicated service:
```text
GoFileService
```
Configuration:
```env
GOFILE_API_KEY=
```
Keep this secret only on the backend.
The worker must never receive the GoFile credential.
Upload the received place file to GoFile.
Only mark the job completed after GoFile actually returns a valid download URL.
Never generate fake URLs.
# 13. DISCORD PROGRESS
Update one embed throughout the job.
Example sequence:
```text
๐ Creating Job
โ
๐ Verifying Authorization
โ
๐ฅ๏ธ Worker Connected
โ
๐ฆ Exporting Place
โ
๐ก Receiving Place Data
โ
โ๏ธ Uploading to GoFile
โ
โ
Complete
```
Never fake percentages.
If exact byte progress is known, display it.
# 14. SUCCESS MESSAGE
Example:
```text
โ
Roblox Export Complete
Game:
Example Game
Place ID:
6403373529
File:
ExampleGame.rbxl
Size:
42.7 MB
[ Download ]
```
The button must use the actual GoFile URL.
# 15. ERROR HANDLING
Handle:
* invalid Place ID
* unauthorized user
* worker offline
* exporter unavailable
* exporter failure
* export timeout
* stream interruption
* invalid file
* oversized file
* GoFile failure
* network timeout
* Discord API failure
* database failure
Do not crash the entire bot because one job fails.
# 16. RETRY
Implement:
```text
/retry
```
For GoFile failures, retry the upload without repeating the Roblox export whenever the backend still has a valid source stream/file.
If the source no longer exists, clearly state that a new authorized export is required.
# 17. CANCEL
Implement:
```text
/cancel
```
Only:
* the job owner
* configured administrators
can cancel.
# 18. RATE LIMITING
Implement:
```env
USER_COOLDOWN_SECONDS=60
MAX_CONCURRENT_JOBS=3
MAX_FILE_SIZE_MB=500
```
Make these configurable.
# 19. SECURITY
Never log:
```text
DISCORD_TOKEN
GOFILE_API_KEY
EXPORT_CLIENT_SECRET
Roblox credentials
private tokens
```
Use HTTPS for production.
Validate every worker request.
# 20. ADMIN COMMANDS
Implement:
```text
/admin-workers
/admin-jobs
/admin-retry
/admin-cancel
/admin-authorize
```
Only administrators can use them.
# 21. WORKER STATUS
`/status` should display:
```text
RoGrabber
Discord Bot:
๐ข Online
Roblox Worker:
๐ข Online
Active Jobs:
2
Completed:
148
Failed:
6
```
# 22. PROJECT STRUCTURE
Create the complete project:
```text
rograbber/
โ
โโโ bot/
โ โโโ src/
โ โ โโโ index.ts
โ โ โโโ commands/
โ โ โ โโโ decomp.ts
โ โ โ โโโ status.ts
โ โ โ โโโ cancel.ts
โ โ โ โโโ retry.ts
โ โ โ โโโ about.ts
โ โ โโโ embeds/
โ โ โโโ exportEmbeds.ts
โ โโโ package.json
โ
โโโ backend/
โ โโโ src/
โ โ โโโ server.ts
โ โ โโโ routes/
โ โ โ โโโ jobs.ts
โ โ โ โโโ worker.ts
โ โ โโโ services/
โ โ โ โโโ jobService.ts
โ โ โ โโโ gofileService.ts
โ โ โ โโโ robloxMetadata.ts
โ โ โโโ database/
โ โ โ โโโ database.ts
โ โ โโโ utils/
โ โ โโโ validation.ts
โ โ โโโ logger.ts
โ โโโ package.json
โ
โโโ worker/
โ โโโ src/
โ โ โโโ index.ts
โ โ โโโ worker.ts
โ โ โโโ exporter.ts
โ โ โโโ heartbeat.ts
โ โ โโโ stream.ts
โ โโโ package.json
โ
โโโ .env.example
โโโ README.md
โโโ docker-compose.yml
```
# 23. ENVIRONMENT VARIABLES
Generate a complete `.env.example`:
```env
DISCORD_TOKEN=
DISCORD_CLIENT_ID=
DISCORD_GUILD_ID=
BACKEND_URL=
EXPORT_CLIENT_SECRET=
WORKER_ID=
WORKER_NAME=
GOFILE_API_KEY=
USER_COOLDOWN_SECONDS=60
MAX_CONCURRENT_JOBS=3
MAX_FILE_SIZE_MB=500
```
# 24. DEVELOPMENT
Provide:
```bash
npm install
npm run register
npm run dev
```
for the bot.
Provide separate commands for:
```bash
npm run backend
npm run worker
```
so every component can be tested independently.
# 25. TEST MODE
Create a safe test exporter that generates a small harmless in-memory test stream.
Example:
```bash
npm run test-export
```
This must test:
```text
Discord
โ job
โ worker
โ stream
โ backend
โ GoFile
โ Discord
```
without contacting Roblox for the test export.
Mark test jobs clearly.
# 26. README
Create a complete README explaining:
* Discord bot setup
* Backend setup
* Worker setup
* environment variables
* database
* GoFile setup
* Roblox authorization requirements
* exporter configuration
* deployment
* troubleshooting
* security
* third-party licenses
# 27. NO MOCK PRODUCTION FEATURES
Do not create fake:
* Roblox exports
* `.rbxl` files
* GoFile URLs
* worker connections
* successful job states
Every production success must correspond to a real operation.
If the Roblox-side exporter cannot be implemented in the chosen environment, say exactly what external authorized component is required.
# FINAL RESULT
Build everything from scratch so the intended production workflow is:
```text
/decomp 6403373529
โ
Roblox metadata
โ
Authorization
โ
Worker
โ
Real authorized Roblox export
โ
Direct stream
โ
Backend validation
โ
GoFile
โ
Discord download link
```
The project should be runnable, documented, modular, and ready for the authorized Roblox exporter to be connected.
Create the backend with SQLite persistence, authenticated worker routes, streaming validation, Roblox metadata, and real GoFile uploads.
Create the Discord bot with registration, user/admin commands, authorization-aware job creation, progress embeds, cancellation, retry, and status reporting.
Create the independent authorized worker, external exporter adapter, safe test exporter, heartbeat, and streaming uploader.
Add workspace configuration, environment template, Docker Compose, and operational documentation.
Backend: Added Fastify server, SQLite job/worker/authorization persistence, atomic worker claiming, heartbeat monitoring, authenticated routes, streaming multipart validation, SHA-256 checksums, size/type validation, Roblox public metadata lookup, and real GoFile uploads.
Discord bot: Added
/decomp,/status,/cancel,/retry,/about, plus all administrator commands with authorization checks, progress embeds, metadata display, cancellation, retries, and real GoFile download buttons.Worker: Added independent heartbeat/polling worker, atomic job claims, authorization-before-export flow, streaming transfer, external authorized exporter adapter, and a clearly marked safe test exporter.
Project setup: Added workspace package configuration, TypeScript configs,
.env.example,.gitignore, Docker Compose, and comprehensive README documentation.
Production exports require an external authorized Roblox exporter configured through EXPORT_COMMAND; no Roblox credential collection, fake exports, bypasses, or fabricated GoFile links are included.
import decomp from './decomp.js';
import status from './status.js';
import cancel from './cancel.js';
import retry from './retry.js';
import about from './about.js';
import { commands as adminCommands } from './admin.js';
export const commands = [decomp, status, cancel, retry, about, ...adminCommands];