Mirror of a WIP clone of the Scratch API and others made in Django
  • HTML 75%
  • JavaScript 12.4%
  • CSS 9%
  • Python 3.6%
Find a file
2026-01-30 19:36:51 -05:00
_docs Implement R2 project remixes list 2026-01-23 18:44:26 -05:00
accounts Lint the whole thing 2026-01-30 17:14:04 -05:00
apiclone Merge branch 'main' of codeberg.org:heathercat123/apiclone 2026-01-30 18:57:43 -05:00
base_comments testing... 2026-01-30 18:56:15 -05:00
files/uploads Upload default thumbnails 2026-01-04 09:26:21 -05:00
galleries Lint the whole thing 2026-01-30 17:14:04 -05:00
help Lint the whole thing 2026-01-30 17:14:04 -05:00
hosts Move a buncha stuff 2026-01-30 17:31:55 -05:00
internalapi Implement setting instructions/notes from R2 2026-01-23 17:03:36 -05:00
lib Move a buncha stuff 2026-01-30 17:31:55 -05:00
news Lint the whole thing 2026-01-30 17:14:04 -05:00
notifications Merge branch 'main' of codeberg.org:heathercat123/apiclone 2026-01-30 17:32:23 -05:00
projects Merge branch 'main' of codeberg.org:heathercat123/apiclone 2026-01-30 18:57:43 -05:00
siteapi Move a buncha stuff 2026-01-30 17:31:55 -05:00
static Merge branch 'main' of codeberg.org:heathercat123/apiclone 2026-01-26 01:00:21 -05:00
templates remove external scratchfoundation links 2026-01-28 01:31:45 -05:00
userprofiles oops 2026-01-30 19:36:51 -05:00
.gitignore Merge branch 'main' of codeberg.org:heathercat123/apiclone 2026-01-26 01:00:21 -05:00
jinxer.py Lint the whole thing 2026-01-30 17:14:04 -05:00
LICENSE Add LICENSE 2026-01-02 18:36:38 -05:00
manage.py Lint the whole thing 2025-08-09 18:44:00 -04:00
README.md Deprecate full_username 2026-01-15 19:22:38 -05:00
requirements.sh Add git commit view 2026-01-04 11:31:07 -05:00
requirements.txt Start work on compiling tips 2026-01-24 16:17:37 -05:00
upgrade.sh do static stuff properly 2026-01-26 22:36:05 -05:00

APIClone

Work in progress recreation of the main Scratch API, projects API, assets API and uploads API

Requirements

APIClone requires the following to be installed:

  • Python. Only versions 3.12 and 3.13 were tested, but any version from 3.8 to the latest should work in theory.
  • Django. Only versions 4.2 and 5.1 were tested, but any version from 4.0 to the latest one should work in theory.
  • django-cors-headers. For Arch Linux users, there's an AUR package: python-django-cors-headers
  • Pillow. Used for the uploads subdomain.

Optional:

  • PyMemcache. You can disable by deleting the CACHES dictionary from settings.py
  • Memcached (Windows version). Required by PyMemcache, useless without it.
  • Varnish. Varnish isn't actually used by APIClone itself, but it rather wraps around Django and caches everything, effectively avoiding hundreds of possible gateway timeouts while using APIClone on certain lower-end hardware, such as a 2010 laptop, or can be used to just lower the tension on the server.

On Arch Linux, you can run requirements.sh to automatically install every mandatory and optional dependencies. For other distros or operating systems, just use dark magic.

Usage with Scratch-WWW

  1. Clone APIClone and Scratch-WWW:

    git clone https://codeberg.org/heathercat123/apiclone.git
    git clone --depth=1 --single-branch --branch develop https://github.com/scratchfoundation/scratch-www.git
    cd apiclone
    

    You can also use the chipmunk mirror by replacing codeberg.org by code.chipmunk.land if you really want to.

  2. Optional: Start Memcached:

    • On systemd-based Linux distros (which is most of them): sudo systemctl start memcached.
    • On other Linux distros: Read your distribution's manual.
    • On Windows: Execute memcached.exe
  3. Create superuser (admin/ST account): python manage.py createsuperuser

  4. Optional: Collect static files: ```python manage.py collectstatic`` This will create the static_prod directory for production environments.

  5. Start APIClone: python manage.py runserver 8080 Tip: If you don't want to use Varnish but you have already built Scratch-WWW configured to the Varnish port, you may want to replace 8080 by 6081.

  6. Switch to another terminal window.

  7. Optional: Start Varnish:

    • On systemd-based Linux distros: sudo systemctl start varnish.
    • On other Linux distros: Read your distrobition's manual (again!).
  8. Install Scratch-WWW's dependencies and translations:

    cd scratch-www
    npm install
    npm run translate
    
  9. Start Scratch-WWW:

    API_HOST=http://localhost:6081/api \
    ASSET_HOST=http://localhost:6081/assets \
    BACKPACK_HOST=http://localhost:6081/backpack \
    PROJECT_HOST=http://localhost:6081/projectshost \
    STATIC_HOST=http://localhost:6081/uploads \
    FALLBACK=http://localhost:6081 \
    npm start
    

    Replace 6081 by 8080 if not using Varnish.

  10. Open http://localhost:8333/admin.

  11. Log in using the superuser created before.

  12. Select Users, then click on your username.

You can now open http://localhost:8333 in a web browser (without /admin!) and enjoy Scratch-WWW with APIClone. Note that many elements of the website are hard-coded whereas they should be modifiable by the user, such as the home page's "What's Happening" box. Quite a few pages and API endpoints are also missing. Both of these are either currently being worked on or this project may randomly have gotten abandoned. I love life.

Standalone usage

TODO: Write this section.
It's basically like with WWW but without the WWW part and you have to set SCRATCHR2_ONLY in /apiclone/local_settings.py.