Update README for template usage

Completely rewrote README to focus on template functionality:
- Clear "Use This Template" instructions
- Quick 3-step deployment guide
- Comprehensive customization guide
- AI agent modification documentation
- Environment variables reference table
- Troubleshooting section
- First-time setup instructions

Removed old deployment-specific content and replaced with
template-focused documentation for 10,000+ users to fork and customize.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Mikael Westöö
2026-01-23 23:30:31 +01:00
parent 7347586407
commit 7cbe3de772

567
README.md
View File

@@ -1,277 +1,271 @@
# Ryans Recruit Firm - AI Recruitment Site # AI Recruitment Site Template
A professional recruitment website built with Node.js, Express, and PostgreSQL. Features include job listings, application management, CV storage, and admin dashboard. A fully customizable recruitment website template designed for easy deployment and AI agent modification. Built with Node.js, Express, and PostgreSQL with comprehensive environment-based configuration.
## Features ## 🎯 Use This Template
This repository is marked as a template. You can create your own recruitment site in minutes!
### Quick Start (3 Steps)
1. **Use this template** - Click "Use this template" on Gitea
2. **Customize** - Edit `.env` file with your company information
3. **Deploy** - Run the automated deployment script
## ✨ Features
### Public Features ### Public Features
- **Job Listings** - Browse open positions with detailed information - Job listings with search and filters
- **Online Applications** - Submit applications with CV upload - Online application system with CV upload
- **Contact Form** - Get in touch with the recruitment team - Contact form
- **Responsive Design** - Works on desktop, tablet, and mobile - Fully responsive design
- Dynamic branding and content
### Admin Features ### Admin Features
- **Dashboard** - Overview statistics and quick access - Dashboard with statistics
- **Application Management** - View, filter, and manage applicants - Application management
- **CV Downloads** - Download applicant CVs directly - CV downloads and viewing
- **Job Management** - Create, edit, and manage job postings - Job posting management
- **First-time Setup** - Automatic admin account creation on first login - First-time admin account creation
## Technology Stack ### Template Features
- **Environment-based configuration** - All customization via `.env` file
- **Dynamic branding** - Company name, colors, contact info all configurable
- **AI agent friendly** - Clear structure for automated modifications
- **One-click deployment** - Automated Coolify deployment script
- **No hardcoded values** - Everything is configurable
- **Backend**: Node.js + Express ## 🚀 Quick Deployment
- **Database**: PostgreSQL with BYTEA for CV storage
- **Authentication**: Session-based with bcrypt
- **File Upload**: Multer (PDF, DOC, DOCX support)
- **Deployment**: Docker + Docker Compose + Coolify
## Quick Start
### Local Development
1. **Clone the repository**
```bash
git clone <repository-url>
cd ai-recruit-site-template
```
2. **Install dependencies**
```bash
npm install
```
3. **Set up environment**
```bash
cp .env.example .env
# Edit .env with your configuration
```
4. **Start PostgreSQL** (if not using Docker)
```bash
# Install PostgreSQL and create database 'recruitment'
psql -U postgres -c "CREATE DATABASE recruitment;"
```
5. **Run migrations**
```bash
psql -U postgres -d recruitment -f migrations/001_init_schema.sql
psql -U postgres -d recruitment -f migrations/002_seed_data.sql
```
6. **Start the application**
```bash
npm start
```
7. **Access the site**
- Public site: http://localhost:3000
- Admin panel: http://localhost:3000/admin/login
### Docker Development
1. **Start all services**
```bash
docker-compose up -d
```
2. **View logs**
```bash
docker-compose logs -f app
```
3. **Stop services**
```bash
docker-compose down
```
## Deployment to Coolify
### Prerequisites ### Prerequisites
- Coolify account and API token - Gitea account at git.startanaicompany.com
- Gitea repository - Gitea API token
- Cloudflare account (for DNS) - Coolify API token (for deployment)
- Basic command line knowledge
### Environment Variables ### Step 1: Create Your Copy
Use Gitea's template feature to create your own copy:
```bash ```bash
export COOLIFY_TOKEN="your-coolify-api-token" # Or clone the template manually
export GITEA_TOKEN="your-gitea-access-token" git clone https://git.startanaicompany.com/StartanAICompany/ai-recruit-site-template.git my-recruit-site
export CLOUDFLARE_TOKEN="your-cloudflare-api-token" cd my-recruit-site
export COOLIFY_API="https://app.coolify.io/api/v1"
export GITEA_API="https://git.startanaicompany.com/api/v1"
export CLOUDFLARE_API="https://api.cloudflare.com/client/v4"
``` ```
### Step 1: Generate SSH Deploy Keys ### Step 2: Customize Configuration
```bash ```bash
ssh-keygen -t ed25519 -f /tmp/recruitai_deploy_key -C "coolify-recruitai-deploy" -N "" # Copy the example environment file
cp .env.example .env
# Edit .env with your company information
nano .env
``` ```
### Step 2: Create Coolify Project **Minimum required configuration in `.env`:**
```bash ```bash
curl -s -X POST "${COOLIFY_API}/projects" \ # Company Information
-H "Authorization: Bearer ${COOLIFY_TOKEN}" \ COMPANY_NAME="Your Recruitment Firm"
-H "Content-Type: application/json" \ COMPANY_TAGLINE="Your Tagline Here"
-d '{ COMPANY_DESCRIPTION="Your company description"
"name": "RecruitAI",
"description": "AI Recruitment Site" # Branding Colors
}' PRIMARY_COLOR=#2563EB
ACCENT_COLOR=#059669
DARK_COLOR=#1E293B
# Contact Information
CONTACT_EMAIL=info@yourcompany.com
CONTACT_PHONE=+1 (555) 123-4567
CONTACT_ADDRESS=123 Business St, City, State 12345
# Deployment Configuration
SUBDOMAIN=yourname
GITEA_USERNAME=your-gitea-username
GITEA_REPO_NAME=my-recruit-site
``` ```
### Step 3: Add Deploy Key to Coolify ### Step 3: Deploy to Coolify
```bash ```bash
PRIVATE_KEY=$(cat /tmp/recruitai_deploy_key | jq -R -s .) # Set API tokens as environment variables (NOT in .env)
export COOLIFY_API_TOKEN="your-coolify-token"
export GITEA_API_TOKEN="your-gitea-token"
curl -s -X POST "${COOLIFY_API}/private-keys" \ # Copy and run the deployment script
-H "Authorization: Bearer ${COOLIFY_TOKEN}" \ cp deploy-to-coolify.example.sh deploy-to-coolify.sh
-H "Content-Type: application/json" \ chmod +x deploy-to-coolify.sh
-d "{ ./deploy-to-coolify.sh
\"name\": \"recruitai-deploy-key\",
\"description\": \"Deploy key for recruitai repository\",
\"private_key\": ${PRIVATE_KEY}
}"
``` ```
### Step 4: Push to Gitea The script will:
- Create a Coolify application
- Configure domain (yourname.recruitai.startanaicompany.com)
- Set up webhooks for automatic deployments
- Generate database and session secrets
- Trigger initial deployment
**Your site will be live in 2-3 minutes!**
## 🎨 Customization Guide
### Company Information
All company information is configured via environment variables in `.env`:
```bash ```bash
git remote add origin git@git.startanaicompany.com:username/ai-recruit-site-template.git # Company Identity
git add . COMPANY_NAME="Your Recruitment Firm"
git commit -m "Initial commit: AI Recruitment Site" COMPANY_TAGLINE="Finding the Perfect Match for Your Career"
git push -u origin main COMPANY_DESCRIPTION="We specialize in connecting talented professionals..."
# Contact Details
CONTACT_EMAIL=info@yourcompany.com
CONTACT_PHONE=+1 (555) 123-4567
CONTACT_ADDRESS=123 Business St, Suite 100, City, State 12345
BUSINESS_HOURS=Monday - Friday: 9:00 AM - 6:00 PM
# Social Media (leave empty to hide)
SOCIAL_LINKEDIN=https://linkedin.com/company/yourcompany
SOCIAL_TWITTER=https://twitter.com/yourcompany
SOCIAL_FACEBOOK=
``` ```
### Step 5: Add Deploy Key to Gitea ### Branding Colors
Customize your brand colors:
```bash ```bash
cat > /tmp/gitea_deploy_key.json << EOF PRIMARY_COLOR=#2563EB # Main brand color (buttons, links)
ACCENT_COLOR=#059669 # Success/accent color
DARK_COLOR=#1E293B # Dark elements (footer, headings)
```
Colors update automatically across the entire site!
### About Page Content
```bash
ABOUT_MISSION=Our mission statement here
ABOUT_VISION=Our vision statement here
ABOUT_VALUES=Integrity, Excellence, Innovation, Partnership
```
### Services Offered
```bash
SERVICES_LIST=Executive Search,Contract Staffing,Permanent Placement,Career Consulting
```
### Feature Configuration
```bash
MAX_CV_SIZE_MB=5
ALLOWED_CV_TYPES=application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document
```
## 🤖 AI Agent Modification
This template is designed to be easily modified by AI agents like Claude Code. The structure includes:
### Clear File Organization
```
ai-recruit-site-template/
├── config.js # Centralized configuration
├── server.js # Main application
├── public/
│ ├── js/
│ │ └── init.js # Dynamic config injection
│ ├── css/
│ │ └── styles.css # CSS with variables
│ └── *.html # HTML with data attributes
├── migrations/ # Database migrations
└── .env.example # Configuration template
```
### Data Attributes
HTML elements use data attributes for dynamic content:
```html
<div data-company-name>Your Company</div>
<h1 data-company-tagline>Your Tagline</h1>
<a data-contact-email>email@example.com</a>
```
### Configuration API
Frontend can access configuration via API:
```javascript
// GET /api/config returns:
{ {
"title": "Coolify Deploy Key", company: { name, tagline, description },
"key": "$(cat /tmp/recruitai_deploy_key.pub)", branding: { primaryColor, accentColor, darkColor },
"read_only": true contact: { email, phone, address, businessHours },
social: { linkedin, twitter, facebook },
about: { mission, vision, values },
services: { list: [...] }
} }
EOF
curl -s -X POST "${GITEA_API}/repos/username/ai-recruit-site-template/keys" \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
-d @/tmp/gitea_deploy_key.json
``` ```
### Step 6: Create Coolify Application ## 💻 Local Development
### With Docker (Recommended)
```bash ```bash
curl -s -X POST "${COOLIFY_API}/applications/public" \ cp .env.example .env
-H "Authorization: Bearer ${COOLIFY_TOKEN}" \ # Edit .env with your settings
-H "Content-Type: application/json" \
-d '{ docker-compose up -d
"project_uuid": "YOUR_PROJECT_UUID",
"environment_name": "production",
"server_uuid": 0,
"type": "public",
"source": {
"type": "git",
"url": "git@git.startanaicompany.com:username/ai-recruit-site-template",
"branch": "main",
"private_key_uuid": "YOUR_PRIVATE_KEY_UUID"
},
"build_pack": "dockerfile",
"ports_exposes": "3000",
"name": "recruitai"
}'
``` ```
### Step 7: Add Webhook to Gitea Access at: http://localhost:3000
### Without Docker
```bash ```bash
curl -s -X POST "${GITEA_API}/repos/username/ai-recruit-site-template/hooks" \ # Install dependencies
-H "Authorization: token ${GITEA_TOKEN}" \ npm install
-H "Content-Type: application/json" \
-d '{ # Start PostgreSQL (must be running)
"type": "gitea", # Create database 'recruitment'
"config": {
"url": "https://app.coolify.io/api/v1/deploy?uuid=YOUR_APP_UUID", # Copy environment file
"content_type": "json", cp .env.example .env
"http_method": "GET"
}, # Start application
"events": ["push"], npm start
"active": true
}'
``` ```
### Step 8: Configure Cloudflare DNS ## 📊 Technology Stack
```bash - **Backend**: Node.js 18 + Express
curl -s -X POST "${CLOUDFLARE_API}/zones/YOUR_ZONE_ID/dns_records" \ - **Database**: PostgreSQL 15 with BYTEA for CV storage
-H "Authorization: Bearer ${CLOUDFLARE_TOKEN}" \ - **Authentication**: Session-based with bcrypt
-H "Content-Type: application/json" \ - **File Upload**: Multer (PDF, DOC, DOCX)
-d '{ - **Deployment**: Docker Compose + Coolify
"type": "CNAME", - **DNS**: Cloudflare
"name": "recruitai",
"content": "YOUR_COOLIFY_FQDN",
"ttl": 1,
"proxied": false
}'
```
### Step 9: Update Application Domain ## 🔐 Security Features
```bash - Password hashing with bcrypt (10 rounds)
curl -s -X PATCH "${COOLIFY_API}/applications/YOUR_APP_UUID" \ - Secure HTTP-only session cookies
-H "Authorization: Bearer ${COOLIFY_TOKEN}" \ - SQL injection protection (parameterized queries)
-H "Content-Type: application/json" \ - File upload validation (type and size)
-d '{ - Environment-based secrets
"domains": "http://recruitai.startanaicompany.com" - Automatic HTTPS in production
}'
```
### Step 10: Deploy ## 📚 API Documentation
```bash
curl -s -X GET "${COOLIFY_API}/deploy?uuid=YOUR_APP_UUID&force=true" \
-H "Authorization: Bearer ${COOLIFY_TOKEN}"
```
## First Time Setup
### Admin Account
1. Navigate to `/admin/login`
2. On first visit, you'll be prompted to create an admin account
3. Enter your email, password, and full name
4. Click "Create Admin Account"
5. You'll be logged in automatically
### Add Jobs
1. Go to Admin Dashboard → Jobs
2. Click "Create New Job"
3. Fill in job details
4. Click "Save"
## Database Schema
### Tables
- **admins** - Admin user accounts
- **job_postings** - Job listings
- **applicants** - Applicant information
- **applications** - Application submissions with CV storage (BYTEA)
- **contact_submissions** - Contact form messages
### Migrations
Migrations are located in `/migrations/` and run automatically on first Docker startup.
## API Endpoints
### Public APIs ### Public APIs
- `GET /api/jobs` - List all active jobs - `GET /api/config` - Get site configuration
- `GET /api/jobs` - List active jobs
- `GET /api/jobs/:id` - Get job details - `GET /api/jobs/:id` - Get job details
- `POST /api/apply` - Submit application (multipart/form-data) - `POST /api/apply` - Submit application (multipart/form-data)
- `POST /api/contact` - Submit contact form - `POST /api/contact` - Submit contact form
@@ -282,89 +276,94 @@ Migrations are located in `/migrations/` and run automatically on first Docker s
- `GET /api/admin/check` - Check auth status - `GET /api/admin/check` - Check auth status
- `POST /api/admin/logout` - Logout - `POST /api/admin/logout` - Logout
- `GET /api/admin/stats` - Dashboard statistics - `GET /api/admin/stats` - Dashboard statistics
- `GET /api/admin/applications` - List applications - `GET /api/admin/applications` - List applications (with filters)
- `GET /api/admin/applications/:id` - Get application details - `GET /api/admin/applications/:id` - Get application details
- `GET /api/admin/applications/:id/cv` - Download CV - `GET /api/admin/applications/:id/cv` - Download CV
- `PATCH /api/admin/applications/:id` - Update application - `PATCH /api/admin/applications/:id` - Update application status
- `GET /api/admin/jobs` - List all jobs - `GET /api/admin/jobs` - List all jobs
- `POST /api/admin/jobs` - Create job - `POST /api/admin/jobs` - Create job
- `PATCH /api/admin/jobs/:id` - Update job - `PATCH /api/admin/jobs/:id` - Update job (activate/deactivate)
- `DELETE /api/admin/jobs/:id` - Delete job
## Security Features ## 🆘 Troubleshooting
- **Password Hashing** - bcrypt with 10 rounds ### Deployment Issues
- **Session Management** - Secure HTTP-only cookies
- **SQL Injection Protection** - Parameterized queries
- **File Upload Validation** - Type and size checks
- **CSRF Protection** - Session-based authentication
- **Rate Limiting** - (Recommended to add in production)
## Environment Variables
| Variable | Description | Default |
|----------|-------------|---------|
| `DB_HOST` | PostgreSQL host | `postgres` |
| `DB_PORT` | PostgreSQL port | `5432` |
| `DB_NAME` | Database name | `recruitment` |
| `DB_USER` | Database user | `postgres` |
| `DB_PASSWORD` | Database password | `changeme123` |
| `PORT` | Application port | `3000` |
| `NODE_ENV` | Environment | `production` |
| `SESSION_SECRET` | Session encryption key | *(required)* |
## File Upload Limits
- **Max CV Size**: 5MB
- **Allowed Types**: PDF, DOC, DOCX
- **Storage**: PostgreSQL BYTEA column
## Troubleshooting
### Database Connection Issues
```bash ```bash
# Check if PostgreSQL is running # Check Coolify logs
docker-compose ps # Visit: https://app.coolify.io → Your Application → Logs
# View PostgreSQL logs # Re-trigger deployment
curl -X POST "https://app.coolify.io/api/v1/applications/YOUR_APP_UUID/restart" \
-H "Authorization: Bearer $COOLIFY_API_TOKEN"
```
### Database Issues
```bash
# Check database connection
docker-compose logs postgres docker-compose logs postgres
# Restart PostgreSQL # Access database
docker-compose restart postgres
```
### Migration Errors
```bash
# Connect to database
docker-compose exec postgres psql -U postgres -d recruitment docker-compose exec postgres psql -U postgres -d recruitment
# Check tables # List tables
\dt \dt
# Re-run migrations manually
docker-compose exec postgres psql -U postgres -d recruitment -f /docker-entrypoint-initdb.d/001_init_schema.sql
``` ```
### Application Won't Start ### Configuration Not Updating
```bash Make sure you:
# Check application logs 1. Updated `.env` file
docker-compose logs app 2. Committed and pushed changes (triggers webhook)
3. Waited 2-3 minutes for redeployment
# Rebuild and restart ## 🎓 First Time Setup
docker-compose down
docker-compose build --no-cache
docker-compose up -d
```
## License 1. Visit your deployment URL
2. Go to `/admin/login`
3. System detects no admin exists
4. Fill in email, password, and full name
5. Click "Create Admin Account"
6. You're logged in!
MIT ## 📝 Environment Variables Reference
## Support | Variable | Description | Default | Required |
|----------|-------------|---------|----------|
| `COMPANY_NAME` | Your company name | Your Recruitment Firm | Yes |
| `COMPANY_TAGLINE` | Main tagline | Finding the Perfect Match... | Yes |
| `COMPANY_DESCRIPTION` | Company description | We specialize in... | Yes |
| `PRIMARY_COLOR` | Primary brand color | #2563EB | No |
| `ACCENT_COLOR` | Accent color | #059669 | No |
| `DARK_COLOR` | Dark color | #1E293B | No |
| `CONTACT_EMAIL` | Contact email | info@yourcompany.com | Yes |
| `CONTACT_PHONE` | Contact phone | +1 (555) 123-4567 | Yes |
| `CONTACT_ADDRESS` | Physical address | 123 Business St... | Yes |
| `BUSINESS_HOURS` | Business hours | Monday - Friday... | No |
| `SOCIAL_LINKEDIN` | LinkedIn URL | (empty) | No |
| `SOCIAL_TWITTER` | Twitter URL | (empty) | No |
| `SOCIAL_FACEBOOK` | Facebook URL | (empty) | No |
| `SUBDOMAIN` | Your subdomain | yourname | Yes (deploy) |
| `GITEA_USERNAME` | Your Gitea username | - | Yes (deploy) |
| `GITEA_REPO_NAME` | Your repo name | - | Yes (deploy) |
| `DB_PASSWORD` | Database password | (auto-generated) | No |
| `SESSION_SECRET` | Session secret | (auto-generated) | No |
| `MAX_CV_SIZE_MB` | Max CV file size | 5 | No |
| `ALLOWED_CV_TYPES` | Allowed CV MIME types | pdf,doc,docx | No |
For issues or questions, contact: info@ryansrecruit.com ## 🤝 Contributing
Webhook configured successfully!
# Repository moved to organization This is a template repository. Feel free to:
- Fork it for your own recruitment site
- Customize it to your needs
- Submit improvements via pull request
## 📄 License
MIT License - feel free to use for commercial projects
## 🆘 Support
For issues or questions:
- Check the [How to set up a template repo guide](/home/milko/projects/airepotemplates/How-to-set-up-a-template-repo.md)
- Contact: info@startanaicompany.com