A simple Pastebin-like application built with FastAPI, React, TypeScript. This application is intentionally built with minimal security measures for educational purposes in security courses.
- Code snippet creation and editing
- Support for multiple programming languages:
- TypeScript
- JavaScript
- Python
- Java
- C++
 
- Syntax highlighting using CodeMirror
- File upload functionality
- Basic user authentication
- Unique URLs for each saved snippet
- SQLite database with SQLAlchemy ORM
This application is deliberately built WITHOUT security measures for educational purposes. It contains various vulnerabilities including but not limited to:
- SQL Injection possibilities
- No input validation
- Weak authentication
- No CSRF protection
- Potential XSS vulnerabilities
DO NOT USE THIS IN PRODUCTION!
- Python 3.10 (required for dependency compatibility)
- Node.js (v18 or higher)
- npm (Node Package Manager)
- Clone the repository:
git clone [repository-url]
cd python-learn_pastebin- Create and activate virtual environment:
# Create virtual environment
python3.10 -m venv venv
# Activate virtual environment
# On macOS/Linux:
source venv/bin/activate
# On Windows:
venv\Scripts\activate- Install Python dependencies:
pip install --upgrade pip
pip install -r requirements.txt- Install frontend dependencies and build:
cd frontend
npm install
npm run build
cd ..- Start the application:
python main.py- 
Access the application at http://localhost:3000
- 
Login with default credentials: - Username: admin
- Password: codesignal
 
- Username: 
- 
Create new snippets: - Enter a title
- Select a programming language
- Write or paste your code
- Click "Save" to generate a unique URL
 
- 
Upload files: - Click the file upload button
- Select a text file
- The content will be automatically loaded into the editor
 
- 
Access saved snippets: - Use the generated URL (format: /snippet/:id)
- Edit and save changes as needed
 
- Use the generated URL (format: 
# Ensure virtual environment is activated
source venv/bin/activate  # On Windows: venv\Scripts\activate
# Run backend (will also serve frontend)
python main.pyThe application runs on port 3000 by default.
If you encounter issues:
- Python version issues: Ensure you're using Python 3.8+
- Installing Python 3.11:
- macOS: brew install python@3.11
- Ubuntu: sudo apt install python3.11 python3.11-venv
- Windows: Download from python.org
 
- macOS: 
- Module not found errors: Make sure virtual environment is activated and dependencies are installed
- Port already in use: The app will try to use port 3000
- Database issues: Delete database.sqlitefile and restart
- POST /api/auth/login- User authentication
- POST /api/auth/register- User registration
- POST /api/snippets- Create/update snippets
- GET /api/snippets/:id- Retrieve a specific snippet
This is a demo application for educational purposes. If you find any bugs or want to suggest improvements, please open an issue or submit a pull request.