Azura411/cybertune-recruit-2025
# CyberTune Recruit 2025
## Setup Instructions
### 1. Supabase Setup
1. Create a new project at [Supabase](https://supabase.com/)
2. Get your `SUPABASE_URL` and `SUPABASE_ANON_KEY` from Project Settings > API
3. Create the `rekrutmen2025` table with this SQL:
CREATE TABLE rekrutmen2025 ( id SERIAL PRIMARY KEY, namapanggilan VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, whatsapp VARCHAR(20) NOT NULL, nim VARCHAR(20) NOT NULL, angkatan VARCHAR(4) NOT NULL, prodi VARCHAR(255) NOT NULL, alasan TEXT NOT NULL, pengalaman TEXT, cvurl TEXT, fotourl TEXT, createdat TIMESTAMP DEFAULT NOW() );
### 2. Google Apps Script Setup
1. Go to [Google Apps Script](https://script.google.com/)
2. Create a new project
3. Replace the default code with the provided Apps Script code (see below)
4. Deploy as Web App:
- Click "Deploy" > "New deployment"
- Select "Web app"
- Set "Execute as" to "Me"
- Set "Who has access" to "Anyone"
- Deploy and copy the Web App URL
### 3. Apps Script Code
const APIKEY = "YOURAPPSSCRIPTAPIKEY"; // Same as APPSSCRIPTAPIKEY in config.js const FOLDERID = "YOURGOOGLEDRIVEFOLDER_ID"; // Create a folder in Google Drive and copy its ID
function doPost(e) { try { // Check API key const apiKey = e.parameter['x-api-key'] || (e.postData ? JSON.parse(e.postData.contents).xApiKey : null); if (apiKey !== API_KEY) { return ContentService.createTextOutput(JSON.stringify({ error: "Unauthorized: Invalid API key" })).setMimeType(ContentService.MimeType.JSON); }
// Get the uploaded files const cvFile = e.parameter.cvFile; const fotoFile = e.parameter.fotoFile;
const folder = DriveApp.getFolderById(FOLDER_ID); const response = {};
if (cvFile) { const cvBlob = Utilities.newBlob(cvFile, "application/pdf", "cv.pdf"); const cvDriveFile = folder.createFile(cvBlob); response.cvUrl = cvDriveFile.getUrl(); response.cvFileId = cvDriveFile.getId(); }
if (fotoFile) { const fotoBlob = Utilities.newBlob(fotoFile, "image/jpeg", "foto.jpg"); const fotoDriveFile = folder.createFile(fotoBlob); response.fotoUrl = fotoDriveFile.getUrl(); response.fotoFileId = fotoDriveFile.getId(); }
return ContentService.createTextOutput(JSON.stringify(response)) .setMimeType(ContentService.MimeType.JSON); } catch (error) { return ContentService.createTextOutput(JSON.stringify({ error: error.toString() })).setMimeType(ContentService.MimeType.JSON); } }
### 4. Configuration
1. Update `config.js` with your actual values:
- `SUPABASE_URL`
- `SUPABASE_ANON_KEY`
- `APPS_SCRIPT_UPLOAD_URL` (from step 2)
- `APPS_SCRIPT_API_KEY` (same as in Apps Script code)
### 5. Deployment
1. Upload all files to your web server
2. Make sure `config.js` is accessible
3. Test the application