{"id":29894149,"url":"https://github.com/juxt/site-lambda-example","last_synced_at":"2025-10-11T14:37:42.347Z","repository":{"id":37766873,"uuid":"497836090","full_name":"juxt/site-lambda-example","owner":"juxt","description":"Example Site/XT development environment with REPL support","archived":false,"fork":false,"pushed_at":"2022-06-30T08:14:59.000Z","size":13355,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-07-29T14:45:02.207Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/juxt.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-30T07:31:41.000Z","updated_at":"2022-05-30T13:59:17.000Z","dependencies_parsed_at":"2022-09-01T06:11:27.174Z","dependency_job_id":null,"html_url":"https://github.com/juxt/site-lambda-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/juxt/site-lambda-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juxt%2Fsite-lambda-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juxt%2Fsite-lambda-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juxt%2Fsite-lambda-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juxt%2Fsite-lambda-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/juxt","download_url":"https://codeload.github.com/juxt/site-lambda-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juxt%2Fsite-lambda-example/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268171716,"owners_count":24207417,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-08-01T04:45:21.995Z","updated_at":"2025-10-11T14:37:37.320Z","avatar_url":"https://github.com/juxt.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lambda-based Site-service template\n\nThis template app uses [Integrant](https://github.com/weavejester/integrant) to setup a local [Site](https://github.com/juxt/site) component. Start the REPL with `clj -M:dev` then type `(go)` to start an embedded Site instance which comes equipped with basic authorization (admin:admin), GraphQL tools and a sample schema. Now head to: http://localhost:2021/_site/insite/app/apis/\n\n## REPL commands\n\nThe template app uses [Integrant](https://github.com/weavejester/integrant) to setup a local [Site](https://github.com/juxt/site) instance. Start the REPL with `clj -M:dev` then type `(go)` to start an embedded Site instance equipped with related tooling.\n\nNow head to: http://localhost:2021/_site/insite/app/apis/graphql?url=/playground/graphql to start playing with a simple \"Entity\" schema. If requested, use admin/admin user password at login. You should see something like:\n\n![GraphiQL Console](graphiql.png?raw=true \"Title\")\n\n## Entity Playground Schema\n\nThe \"Entity\" playground schema is available in `site-modules/playground`. After starting the REPL and `(go)`, the schema is available as explained above. If you want to play with the schema and change it, there are several ways to keep the schema up to date:\n\n* If you have the REPL open and initialised, you can use `(deploy-schema)` to push the current content of the schema to Site.\n* Alternatively, head over to `site-modules/playground` and use the `deploy.sh` script to push the latest changes. The folder also contains an `auto-refresh.sh` script to watch the schema files and update them automatically in case of changed. It requires [entr](https://github.com/clibs/entr).\n* The provided [end-2-end test](test/pro/juxt/entity_end2end_test.clj) (see below) also refresh the schema with the latest changes.\n\n## Panic button\n\nSite stores changes in the local XTDB node (the `.xtdb` folder). In case you want to restart from a clean Site installation (which still includes the playground and related tools), use the `(nuke!)` command from the REPL, restart the REPL and hit `(go)` again. It will reset to the original installation and get rid of any subsequent changes. You can also manually `rm -rf .xtdb` with the same effect.\n\n## Changing the seed data\n\nIf you want to change the seed data creating a new snapshot, follow the \"Panic button\" instructions above then restart the REPL.\n\n### With admin user and login\n\n* Follow the \"Panic button\" instructions above.\n* Restart the REPL.\n\n```clojure\n(go :skip-init true)\n(put-site-api!)\n(site-repl/put-auth-resources!)\n(site-repl/put-superuser-role!)\n(site-repl/put-superuser! \"admin\" \"admin\" \"admin\")\n```\n\n* Now open another terminal and `git clone https://github.com/juxt/site` and `cd opt/login-form` and follow the instructions to install the login form (look at site-modules/playground/deploy.sh for problem with tokens and executables).\n* At the REPL type `(site-repl/export-resources)` to create a new YYYY-MM-GG-HHMMSS.edn.zip file in the root folder.\n* Move the file to `site-modules/seed/with-admin-user.edn.zip`\n\n### Installing GraphiQL\n\nInstalling GraphiQL in the snapshot is a little more involved, because it requires the node/yarn development tool chain. Instructions are available at https://github.com/juxt/site/tree/master/opt/insite-console. Once done, the steps are the same as above, export-resources creating a new snapshot file.\n\n## End2End testing\n\nThe project contains an example of [end2end testing](test/pro/juxt/entity_end2end_test.clj) storing, retrieving and delete entities from Site. The test fixtures will start a Site instance unless one is already running (assuming it was started from the REPL).\n\n## The `do` command\n\nThe project contains a `do` executable script that invokes the related Clojure and Terraform build commands. It is there to avoid some additional typing and make it quicker to execute commands. Use with:\n\n```clojure\n./do test     # Run the test suite\n./do compile  # Compile Clojure and create the uberjar ready for deploy\n./do init     # One off to setup Terraform\n./do plan     # To check Terraform changes\n./do apply    # Apply Terraform changes and deploy the Lambda\n./do destroy  # To tear down Terraform changes\n./do run      # Run the lambda function and print the results\n```\n\nPlease be aware of the following dependencies when you run the `do` tasks:\n\n* `plan`, `apply` and `destroy` depends on a one off execution of `init`.\n* `apply` depends on `compile` to find the `target/lambda.jar` package to deploy.\n* `run` depends on `apply` so the Lambda function can be found.\n\n## Local Setup\n\n### AWS credentials for local development\n\nIf you have an AWS account, install the https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html[AWS Command Line Interface] also known as the AWS CLI. You should see something like the following after installing:\n\n```bash\nλ: aws --version\naws-cli/1.22.87 Python/3.10.4 Linux/5.17.1-arch1-1 botocore/1.24.32\n```\n\nUsing the account, you should now create an access key and secret which is essentially an id and password pair that an application can use to use AWS services. `aws-cli`, Terraform and any other application wishing to authenticate will need to use this id and password combination. To generate one, follow the steps at this https://docs.aws.amazon.com/cli/latest/userguide/getting-started-prereqs.html#getting-started-prereqs-keys[link]. Once you have the access-key and secret pair, you can use `aws configure` to set it up. This will write a `~/.aws` folder in your home path with the necessary information. The configuration will require a region and an output format. You can find a region suitable to you (for example, `eu-west-1`) by clicking the region selector at the top of the AWS console landing page. The output format can be `json`, `yaml` or plain `text`. You can test that your setup works properly for example listing all the buckets available in S3:\n\n```bash\nλ: aws s3 ls\n```\n\nIf the command shows no output, it's a good sign,  no errors and no buckets to show.\n\n### Installing Terraform\n\nIn the next step, we are installing the Terraform command line utilities. There are https://learn.hashicorp.com/tutorials/terraform/install-cli?in=terraform/aws-get-started[good instructions here] if you need help. Once you're done, you should be able to type `terraform` in a terminal and see something like the following:\n\n```bash\nλ: terraform -v\nTerraform v1.1.7\non linux_amd64\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuxt%2Fsite-lambda-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuxt%2Fsite-lambda-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuxt%2Fsite-lambda-example/lists"}