Skip to content
artsyPublic

About

Internal static site hosting for Artsy and Artnet

Resources

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

Atelier

Atelier is a static site hosting solution for use internally at Artsy and Artnet.

User experience demo

The goal is to provide a dead-simple, low-friction, drag-and-drop solution for colleagues to share their html creations.

While the motivation was to accommodate the increasing number of vibecoded creations generated by non-engineers, it works just as well for artisanally created html, static site generator output, or any other method that results in a folder containing static html/css/js/etc.

Meta

Architecture

Architecture sketch via tldraw Source

Every static site managed by atelier lives inside a designated S3 bucket called artsy-atelier.

# S3

├── artsy-atelier
│   ├── braze-dash  # https://braze-dash.artsy.dev
│   ├── dbt-docs    # https://dbt-docs.artsy.dev
│   ├── price-game  # https://price-game.artsy.dev
│   └── art-quiz    # https://art-quiz.artsy.dev
│
other-buckets…

Apart from S3 storage, the remaining components are:

  • Serving site content: handled by Cloudfront
  • Uploading site content: handled by this project, artsy/atelier
  • Access control: handled by Cloudflare Access

Each piece is described below.


Serving site content

  • The artsy-atelier bucket itself has no public access, instead…

  • The bucket is fronted by a Cloudfront distribution (E22U9CWUDKPZP6)

  • The distribution is permitted to reach into the bucket and serve up Atelier content via a CloudFront Origin Access Control (OAC) paired with an S3 bucket policy that scopes s3:GetObject to that specific distribution

  • The subdomain-to-subfolder routing is handled by a Cloudfront function (atelier-poc-router) which is associated to that distribution

Note that this setup is actually all it takes to serve content out of that bucket to a custom *.artsy.dev subdomain. The remaining pieces are what make it easy and safe and for non-engineering users to interact with Atelier.


Uploading site content

  • This repo provides a simple drop-zone based UI that allows anyone to take some html/etc content, zip it up into an archive and drop it into Atelier

  • It is a Next.js (Pages Router) app written in TypeScript, using React and Artsy's Palette design system, deployed to Artsy's k8s cluster via Hokusai. It serves:

    • GET / — the drop zone UI
    • GET /sites — a browsable listing of all sites, as a thumbnail grid or a table
    • POST /api/upload — endpoint that takes a site name, a zip archive, and then unpacks and stores the zip content to the appropriately named subfolder inside the artsy-atelier S3 bucket
    • GET /api/check — endpoint that checks for subfolder existence to allow confirming of overwrites
    • GET /api/sites — endpoint that lists existing sites
    • GET /api/thumbnails/:slug — a site's thumbnail, captured at upload time
    • GET /api/status — health check, used as the Kubernetes readiness probe

To run it locally:

yarn install
cp .env.example .env  # then fill in the required values
yarn dev              # next dev
yarn test             # jest
yarn lint && yarn typecheck

yarn sites:list prints the sites currently in the bucket.


Access control for both site content and uploading

  • Cloudflare Access gates every *.artsy.dev subdomain behind single sign-on, covering both the static sites and the upload app.

  • This ensures that Atelier remains a purely internally facing system, for both reads and writes.

Automating uploads to Atelier

While the typical upload flow is designed around a human using the drop-zone UI in a browser, we also have the ability to automate uploads programmatically by emulating the form submission.

An IRL example of using curl for this:

curl -X POST https://atelier.artsy.dev/api/upload \
  -H "CF-Access-Client-Id: $ATELIER_CF_ACCESS_CLIENT_ID" \
  -H "CF-Access-Client-Secret: $ATELIER_CF_ACCESS_CLIENT_SECRET" \
  -H "X-Requested-By: somebody@artsymail.com" \
  -F slug=dbt-elementary-report \
  -F zip=@report.zip \
  -F confirm=true
  • The ATELIER_CF_ACCESS_CLIENT_ID / ATELIER_CF_ACCESS_CLIENT_SECRET pair is a Cloudflare service token credential that allows applications to reach Atelier, since it is protected by Cloudflare Access. You can find this in the 1Password entry for Atelier.

  • The X-Requested-By email address is used for attribution metadata inside Atelier. Best to provide a valid email address, whether it@artsymail.com or an individual who is responsible for this particular Atelier site.

  • Update the slug and zip args to reflect your use case.

  • confirm=true is what allows the upload to overwrite existing site contents, which is likely what you want for a recurring automated upload.

Contributing

TODO — perhaps after a KS where we decide which quirky Hackathon-esque development practices to leave in place, and which ones to jettison in favor of standard practices.

About

Internal static site hosting for Artsy and Artnet

Resources

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Used by

Contributors

Languages