{"id":44708337,"url":"https://github.com/ikelaiah/fpc-playground","last_synced_at":"2026-02-15T11:13:57.102Z","repository":{"id":303972660,"uuid":"1017214228","full_name":"ikelaiah/fpc-playground","owner":"ikelaiah","description":"A simple way to run Free Pascal programs in the browser so new developers can learn the language without having to install anything.","archived":false,"fork":false,"pushed_at":"2025-08-04T07:57:16.000Z","size":1982,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-04T10:57:06.560Z","etag":null,"topics":["code-playground","docker","flask","free-pascal","freepascal","python","web","web-interface"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ikelaiah.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-10T07:41:29.000Z","updated_at":"2025-08-04T07:57:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"f3638f5a-09b1-4ef7-b324-5ff615e87bb5","html_url":"https://github.com/ikelaiah/fpc-playground","commit_stats":null,"previous_names":["ikelaiah/fpc-playground"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ikelaiah/fpc-playground","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikelaiah%2Ffpc-playground","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikelaiah%2Ffpc-playground/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikelaiah%2Ffpc-playground/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikelaiah%2Ffpc-playground/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ikelaiah","download_url":"https://codeload.github.com/ikelaiah/fpc-playground/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ikelaiah%2Ffpc-playground/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29476300,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T10:25:47.032Z","status":"ssl_error","status_checked_at":"2026-02-15T10:25:01.815Z","response_time":118,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-playground","docker","flask","free-pascal","freepascal","python","web","web-interface"],"created_at":"2026-02-15T11:13:56.905Z","updated_at":"2026-02-15T11:13:57.093Z","avatar_url":"https://github.com/ikelaiah.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 FPC Playground\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-1E3A8A.svg)](https://opensource.org/licenses/MIT)\n[![Free Pascal](https://img.shields.io/badge/Free%20Pascal-3.2.2+-3B82F6.svg)](https://www.freepascal.org/)\n![Python](https://img.shields.io/badge/Python-3.9+-A7F3D0?logo=python\u0026logoColor=white)\n![Flask](https://img.shields.io/badge/Flask-2.0+-A7F3D0?logo=flask\u0026logoColor=white)\n![Docker](https://img.shields.io/badge/Docker-20.10+-2496ED?logo=docker)\n![Web](https://img.shields.io/badge/Web-HTML%2FCSS%2FJS-E34F26?logo=html5)\n![Supports Windows](https://img.shields.io/badge/support-Windows-F59E0B?logo=Windows)\n![Supports Linux](https://img.shields.io/badge/support-Linux-F59E0B?logo=Linux)\n[![Version](https://img.shields.io/badge/version-0.3.0-8B5CF6.svg)](CHANGELOG.md)\n\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://fpc-playground-app-mgeib.ondigitalocean.app/\"\u003e\n    \u003cimg src=\"assets/250804-logo-v1-256.png\" width=\"320\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\nA simple way to run Free Pascal programs in the browser so new developers can learn the language without having to install anything.\n\nGive it a try here: [FPC Playground](https://fpc-playground-app-mgeib.ondigitalocean.app/)\n\n\u003e [!WARNING]\n\u003e This project is still a work in progress and will not support all Free Pascal features.\n\n![FPC Playground Screenshot](assets/2025-08-04-screenshot.png)\n\n## Table of Contents\n- [🚀 FPC Playground](#-fpc-playground)\n  - [Table of Contents](#table-of-contents)\n  - [🌟 Features](#-features)\n  - [✋ Prerequisites](#-prerequisites)\n  - [🚀 Quick Start](#-quick-start)\n  - [⭐ Feedback](#-feedback)\n  - [🏃 Running Locally](#-running-locally)\n    - [Using Docker Compose](#using-docker-compose)\n  - [🎓 Using the Playground](#-using-the-playground)\n    - [**Code Editor**](#code-editor)\n    - [**Program Arguments**](#program-arguments)\n    - [**User Input**](#user-input)\n    - [**Example Usage**](#example-usage)\n    - [Without Docker Compose](#without-docker-compose)\n      - [Backend](#backend)\n      - [Frontend](#frontend)\n  - [🧪 Testing with `curl`](#-testing-with-curl)\n    - [Test a simple \"Hello, World!\" program](#test-a-simple-hello-world-program)\n  - [🙌 Contributing](#-contributing)\n  - [⚖️ License](#️-license)\n  - [🙏 Acknowledgments](#-acknowledgments)\n\n## 🌟 Features\n\n- **Web-based Pascal editor** with syntax highlighting\n- **Real-time compilation** and execution\n- **Program arguments support** - Pass command line arguments to your Pascal programs\n- **User input support** - Handle `ReadLn()` statements with dedicated input fields\n- **Example programs** to get started quickly\n- **Security filtering** to prevent dangerous operations\n- **Educational-friendly interface** with clear separation of code, input, and output\n\n## 🔒 Security Features\n\n- **Smart Keyword Detection**: Advanced pattern matching prevents dangerous operations while allowing legitimate code\n- **Multi-layered Validation**: Character encoding, complexity checks, and comprehensive threat detection\n- **Word Boundary Matching**: Uses regex word boundaries (`\\b`) for precise keyword detection\n- **Context-Aware Shell Detection**: Shell commands only blocked in dangerous contexts (e.g., `sh -c`, `/bin/sh`)\n- **Educational Focus**: Secure enough for learning environments, flexible enough for creativity\n\n## ✋ Prerequisites\n\nMake sure you have Docker installed. You can download it from [Docker's official site](https://www.docker.com/get-started).\n\n## 🚀 Quick Start\n1. Clone the repository: `git clone https://github.com/ikelaiah/fpc-playground.git`\n2. Run Docker Compose: `docker-compose up`\n3. Access the frontend at `http://localhost:8080` and start coding!\n\n## ⭐ Feedback\nWe value your feedback! If you enjoy using FPC Playground, please star the repository and share your thoughts.\n\n## 🏃 Running Locally\n\n### Using Docker Compose\n\nTo simplify setup, you can use Docker Compose to run both the backend and frontend services:\n\n1. Clone the repository:\n\n```bash\ngit clone https://github.com/ikelaiah/fpc-playground.git\n```\n\n2. Navigate to the project directory:\n\n```bash\ncd fpc-playground\n```\n\n3. Run Docker Compose:\n\n```bash\ndocker-compose up\n```\n\n4. Access the frontend at `http://localhost:8080` and the backend at `http://localhost:5000`.\n\n## 🎓 Using the Playground\n\nThe FPC Playground provides an intuitive interface for learning Pascal programming:\n\n### **Code Editor**\n- Write your Pascal code with syntax highlighting\n- Use the example buttons to load pre-written programs\n- Fix quotes automatically for Pascal compatibility\n\n### **Program Arguments**\n- Use the \"Program Arguments\" textarea to pass command line arguments to your program\n- Separate multiple arguments with spaces\n- Example: `arg1 arg2 arg3`\n\n### **User Input**\n- Use the \"User Input\" textarea to provide input for `ReadLn()` statements\n- Enter each input value on a separate line\n- The program will read these values in order when it encounters `ReadLn()`\n\n### **Example Usage**\n```pascal\nprogram TestInput;\nvar\n    name: string;\n    age: integer;\nbegin\n    writeln('What is your name?');\n    readln(name);\n    writeln('How old are you?');\n    readln(age);\n    writeln('Hello ', name, ', you are ', age, ' years old!');\nend.\n```\n\nFor this program, enter in the User Input field:\n```\nJohn\n25\n```\n\nThe output will be:\n```\nWhat is your name?\nHow old are you?\nHello John, you are 25 years old!\n```\n\n### Without Docker Compose\n\n#### Backend\n\nTo run the backend manually without Docker Compose, follow these steps:\n\n1. Clone the repository:\n\n```bash\ngit clone https://github.com/ikelaiah/fpc-playground.git\n```\n\n2. Navigate to the `backend` directory:\n\n```bash\ncd fpc-playground/backend\n```\n\n3. Build the Docker image:\n\n```bash\ndocker build -t fpc-playground-backend .\n```\n\n4. Run the Docker container:\n\n```bash\ndocker run -p 5000:5000 fpc-playground-backend\n```\n\n#### Frontend\n\nThe frontend is a simple HTML page that interacts with the backend API using JavaScript.\n\nTo run the frontend manually, you can simply open the `index.html` file in your web browser. It will automatically connect to the backend running on `http://localhost:5000`.\n\n## 🧪 Testing with `curl`\n\nRun the following commands to test the backend using `curl`:\n\n```bash\ncd backend\ndocker build -t fpc-playground-backend .\ndocker run -p 5000:5000 fpc-playground-backend\n```\n\n### Test a simple \"Hello, World!\" program\n\n**Note**: The API requires base64 encoded Pascal code, arguments, and input.\n\n```bash\n# Create test payload with base64 encoded Pascal code\necho '{\"code\":\"'$(echo \"program HelloWorld; begin writeln('Hello, World!'); end.\" | base64 -w 0)'\",\"args\":\"\",\"input\":\"\"}' \u003e test.json\ncurl -X POST http://localhost:5000/run -H \"Content-Type: application/json\" -d @test.json\n```\n\n**Alternative method using a helper script:**\n```bash\n# Create a simple test script\ncat \u003e test_api.sh \u003c\u003c 'EOF'\n#!/bin/bash\nCODE=\"program HelloWorld; begin writeln('Hello, World!'); end.\"\nENCODED_CODE=$(echo -n \"$CODE\" | base64 -w 0)\necho '{\"code\":\"'$ENCODED_CODE'\",\"args\":\"\",\"input\":\"\"}' | curl -X POST http://localhost:5000/run -H \"Content-Type: application/json\" -d @-\nEOF\nchmod +x test_api.sh\n./test_api.sh\n```\n\n## ⚠️ Current Limitations\n\n- **Code size**: Maximum 16KB per program\n- **Output size**: Limited to 48KB to prevent abuse\n- **Rate limiting**: 150 requests per hour, 10 per minute\n- **Pascal features**: Not all Free Pascal features supported (work in progress)\n- **Complex structures**: Limited nested structures (max 20 `begin` statements, 100 parentheses, 50 brackets)\n- **Character encoding**: Only standard ASCII characters (32-126) plus newlines, carriage returns, and tabs\n\n## 🔧 Troubleshooting\n\n### Common Issues\n- **\"Code contains restricted keyword\"**: Check for Pascal reserved words in variable names or use different names\n- **\"Code structure too complex\"**: Simplify nested structures or break code into smaller functions\n- **Connection refused**: Ensure Docker containers are running on correct ports (8080 for frontend, 5000 for backend)\n- **Compilation errors**: Verify Pascal syntax - the playground uses Free Pascal 3.2.2+\n- **\"Code contains invalid characters\"**: Use only standard ASCII characters in your code\n\n### Getting Help\n- Check our [Issues page](https://github.com/ikelaiah/fpc-playground/issues) for known problems\n- Join the [Free Pascal Discord](https://discord.com/channels/570025060312547359/570091337173696513) for community support\n- Review the [CHANGELOG.md](CHANGELOG.md) for recent updates and fixes\n\n## 🙌 Contributing\nWe welcome contributions! To contribute:\n1. Fork the repository.\n2. Create a new branch (`git checkout -b feature-branch`).\n3. Make your changes and commit them (`git commit -m \"Add feature\"`).\n4. Push to your branch (`git push origin feature-branch`).\n5. Open a pull request.\n\n## ⚖️ License\n\nMIT License - see [LICENSE](LICENSE.md) file for details.\n\n## 🙏 Acknowledgments\n\n- [Free Pascal Dev Team](https://www.freepascal.org/) for the Pascal compiler\n- [Lazarus IDE Team](https://www.lazarus-ide.org/) for such an amazing IDE\n- The kind and helpful individuals on various online platforms such as:\n    - [Unofficial Free Pascal Discord server](https://discord.com/channels/570025060312547359/570091337173696513)\n    - [Free Pascal \u0026 Lazarus forum](https://forum.lazarus.freepascal.org/index.php)\n    - [Tweaking4All Delphi, Lazarus, Free Pascal forum](https://www.tweaking4all.com/forum/delphi-lazarus-free-pascal/)\n    - [Laz Planet - Blogspot](https://lazplanet.blogspot.com/) / [Laz Planet - GitLab](https://lazplanet.gitlab.io/)\n    - [Delphi Basics](https://www.delphibasics.co.uk/index.html)\n- All contributors who have helped improve this project","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fikelaiah%2Ffpc-playground","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fikelaiah%2Ffpc-playground","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fikelaiah%2Ffpc-playground/lists"}