Advanced Users Only: This method requires experience with Python development, uv package manager, and server management. It’s recommended for developers comfortable with command-line tools and debugging.
Benefits of Local Development
✅ Full Control: Complete access to modify code, add features, and customize functionality ✅ Development Environment: Perfect for testing changes before deployment ✅ Custom Integrations: Add analytics, SEO optimizations, or third-party integrations ✅ Performance Tuning: Optimize database queries and server configuration ✅ Learning Opportunity: Understand the complete application architecturePrerequisites
Before starting, ensure you have:- Python 3.10 or higher installed on your system
- Git for version control
- Basic knowledge of Python development and virtual environments
- Basic knowledge of uv package manager
- Completed MongoDB setup and webhook creation
- Windows
- macOS
- Ubuntu/Debian
- CentOS/RHEL
Setting Up the Development Environment
1
Clone the Repository
Start by cloning the Spoo.me repository to your local machine:
This downloads the complete source code, including all necessary configuration files and dependencies.
2
Installing Dependencies
We use uv to automatically setup the development environment and install the dependencies:
- Windows
- macOS/Linux
Your command prompt should now show
(venv)
at the beginning, indicating the virtual environment is active.3
Configure Environment Variables
Create and configure your environment file:Add your configuration variables:
Never commit your
.env
file to version control. Add it to .gitignore
to prevent accidental commits.Starting the Development Server
1
Start the Application
Launch the Spoo.me development server:You should see output similar to:
The server runs in debug mode by default, which means it will automatically restart when you make code changes.
2
Access Your Application
Open your web browser and navigate to:
- Local access: http://localhost:8000
- Network access: http://your-ip-address:8000
You should see the Spoo.me homepage. Test the URL shortening functionality to ensure everything is working correctly.
3
Test Core Features
Verify all functionality is working:
- URL Shortening: Create a test short URL
- Analytics: Click the short URL and check analytics
- Contact Form: Submit the contact form to test webhooks
- URL Reporting: Test the URL reporting feature
Check your Discord channels to verify webhook notifications are being received.
Development Workflow
Code Structure Overview
Understanding the project structure will help you navigate and modify the code:Making Code Changes
1
Create a Development Branch
Always work on a separate branch for new features:
2
Make Your Changes
Edit the relevant files using your preferred code editor:
The development server automatically reloads when you save changes, so you can see updates immediately.
3
Test Your Changes
Always test your modifications thoroughly:
- Test in the browser
- Check console output for errors
- Verify database operations
- Test edge cases and error handling
4
Commit Your Changes
Use descriptive commit messages:
Production Deployment
When you’re ready to deploy your customized version:1
Production Environment Setup
Create a production environment file:
2
Install Production Dependencies
3
Create Production Startup Script
Create Make it executable:
start_production.sh
:4
Set Up Process Management
Use a process manager like systemd or supervisord:Enable and start the service:
Troubleshooting
Import Errors
Import Errors
Symptoms:
ModuleNotFoundError
or import-related errorsSolutions:- Ensure your virtual environment is activated
- Verify all dependencies are installed:
pip install -r requirements.txt
- Check Python path and working directory
- Install missing packages manually:
pip install package-name
Database Connection Issues
Database Connection Issues
Symptoms: Cannot connect to MongoDB or database errorsSolutions:
- Verify your
MONGODB_URI
in the.env
file - Test connection with the database test script
- Check MongoDB Atlas IP whitelist settings
- Ensure your MongoDB cluster is running
Port Already in Use
Port Already in Use
Symptoms:
Address already in use
error when starting serverSolutions:Template or Static File Issues
Template or Static File Issues
Symptoms: 404 errors for CSS/JS files or template rendering errorsSolutions:
- Verify file paths in templates match actual file locations
- Check Flask static and template folder configuration
- Ensure static files are in the correct directory structure
- Clear browser cache and hard refresh
Contributing Back to the Project
If you’ve made improvements that could benefit others:1
Fork the Original Repository
Create your own fork on GitHub to contribute changes back.
2
Create Feature Branches
Work on separate branches for each feature or fix.
3
Submit Pull Requests
Share your improvements with the community through pull requests.
Check the project’s contribution guidelines and code standards before submitting changes.