{"id":14986074,"url":"https://github.com/briancaffey/cdk-django","last_synced_at":"2025-04-09T16:35:52.532Z","repository":{"id":44372937,"uuid":"361527537","full_name":"briancaffey/cdk-django","owner":"briancaffey","description":"A CDK library that provides high-level constructs for hosting Django applications on AWS","archived":false,"fork":false,"pushed_at":"2024-09-02T00:48:36.000Z","size":321,"stargazers_count":48,"open_issues_count":1,"forks_count":12,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-15T01:32:28.656Z","etag":null,"topics":["aws","cdk","cdk-construct-library","containers","devops","django","docker","ecs","fargate","github-actions","infrastructure-as-code","poetry","projen","terraform","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/briancaffey.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-25T20:09:25.000Z","updated_at":"2024-09-15T06:51:03.000Z","dependencies_parsed_at":"2024-02-09T01:55:30.135Z","dependency_job_id":"4e05ad70-5d16-416f-b625-cecff3b79ce5","html_url":"https://github.com/briancaffey/cdk-django","commit_stats":{"total_commits":69,"total_committers":2,"mean_commits":34.5,"dds":"0.23188405797101452","last_synced_commit":"8149b579193a5d2897e1a0587a520c26c20b147c"},"previous_names":["briancaffey/django-cdk"],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briancaffey%2Fcdk-django","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briancaffey%2Fcdk-django/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briancaffey%2Fcdk-django/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/briancaffey%2Fcdk-django/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/briancaffey","download_url":"https://codeload.github.com/briancaffey/cdk-django/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247202862,"owners_count":20900854,"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","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":["aws","cdk","cdk-construct-library","containers","devops","django","docker","ecs","fargate","github-actions","infrastructure-as-code","poetry","projen","terraform","typescript"],"created_at":"2024-09-24T14:12:17.261Z","updated_at":"2025-04-09T16:35:52.504Z","avatar_url":"https://github.com/briancaffey.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `cdk-django`\n\n## About this construct library\n\n`cdk-django` is a library for deploying Django applications to AWS using ECS Fargate.\n\n`cdk-django` aims to demonstrate best-practices for building web applications in AWS cloud. Executing the code in this project will build cloud resources such as networks, servers and databases that power a web application that can run securely on the public internet.\n\nYou don't need to use this library directly in your code. It is recommended that you use this repo as a guide. It includes common patterns that are used when working with Infrastructure as Code.\n\n### Companion application\n\nThis project has a companion repo that contains a Django (Python) web application backend and a Nuxt.js frontend site (server-rendered Vue.js written in TypeScript). This project can be found here:\n\n[https://github.com/briancaffey/django-step-by-step/](https://github.com/briancaffey/django-step-by-step/)\n\n### Related projects\n\nThis project is has been written with the two other main Infrastructure as Code tools: Terraform and Pulumi. You can find these repos here:\n\n- [terraform-aws-django](https://github.com/briancaffey/terraform-aws-django)\n- [pulumi-aws-django](https://github.com/briancaffey/pulumi-aws-django)\n\n## Project structure\n\nThere are two main constructs the build resources for the different stacks:\n\n- `base`\n- `app`\n\nThe `base` stack deploys long-lived resources that shouldn't need to be updated frequently, these include:\n\n- VPC\n- ElastiCache\n- S3\n- Security Groups\n- Load balancer\n- RDS\n\nThe `app` stack deploys resources primarily for ECS services that run the application processes, these include:\n\n- ECS cluster for the environment\n- web-facing services (for running gunicorn and for running the frontend UI app)\n- celery worker for asynchronous task processing\n- celery beat for scheduled tasks\n- management_command for running migrations and other \"pre-update\" tasks (collectstatic, loading fixtures, etc.)\n- All backend environment variables are configured here (shared between all backend services)\n- Route 53 record for the environment (e.g. `\u003cenv_name\u003e.example.com`)\n- IAM resources (this might be able to be moved to the base stack)\n\n### Local Examples\n\nIt is best to deploy cloud infrastructure with automated pipelines that execute Infrastructure as Code. For testing and development you can deploy locally.\n\nThe `Makefile` in this repo documents the commands to create and destroy infrastructure for the `base` and `app` stacks. For example:\n\n```Makefile\n# base stack\necs-base-synth:\n\tcdk synth --app='lib/examples/ecs/index.js' -e ExampleEcsBaseStack\n\necs-base-diff:\n\tcdk diff --app='./lib/examples/ecs/index.js' -e ExampleEcsBaseStack\n\necs-base-deploy:\n\tcdk deploy --app='./lib/examples/ecs/index.js' -e ExampleEcsBaseStack\n\necs-base-deploy-approve:\n\tcdk deploy --app='./lib/examples/ecs/index.js' --require-approval never -e ExampleEcsBaseStack\n\necs-base-destroy:\n\tyes | cdk destroy --app='./lib/examples/ecs/index.js' -e ExampleEcsBaseStack\n```\n\n## Companion application\n\nTo see how `terraform-aws-django` can be used, have a look at [https://github.com/briancaffey/django-step-by-step](https://github.com/briancaffey/django-step-by-step).\n\nThis companion repo includes two main components: a Django application (backend) and a Nuxt.js application (frontend)\n\n### Django backend application features\n\n- email-based authentication flow (confirmation email + forgot password)\n- microblog app (users can write posts with text and images, like posts)\n- chat app (a simple OpenAI API wrapper)\n\n### Nuxt.js frontend client features\n\n- Vue 3, Nuxt v3.15\n- SSR\n- shadcn\n- tailwindcss\n- pinia\n- composables\n\nThis construct library focuses on security, best practices, scalability, flexibility and cost-efficiency.\n\n## Maintaining this repo\n\nMake sure you are on the most recent version of CDK:\n\n```\nnpm i -g aws-cdk\n```\n\nThis project is managed by [`projen`](https://github.com/projen/projen). To update the application, run the following:\n\n```\nnpx projen upgrade\n```\n\nUpdate [CDK version](https://github.com/aws/aws-cdk/releases) in `.projenrc.ts` and then run:\n\n```\nnpx projen\n```\n\nRun `npx projen watch` in one terminal.\n\n\nIn another terminal, export AWS credentials and environment variables and then run commands in the `Makefile`.\n\nHere are the environment variables you will need to export:\n\n```\nexport DOMAIN_NAME=example.com\nexport CERTIFICATE_ARN=arn:aws:acm:us-east-1:111111111111:certificate/11111111-1111-1111-1111-111111111111\nexport AWS_REGION=us-east-1\nexport AWS_ACCESS_KEY_ID=abc\nexport AWS_SESSION_TOKEN=123\nexport COMPANY_NAME=abc\nexport AWS_ACCOUNT_ID=123456789\n```\n\n## Release process\n\nThis project uses `projen` to manage the release process. There is a GitHub Action called `release` that will make a release and publish it to npm. Before running release, make sure you run `yarn build` to build the documentation, and run `yarn eslint` to fix any linting errors.\n\n## Issues\n\n- [https://github.com/projen/projen/issues/3950](https://github.com/projen/projen/issues/3950)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbriancaffey%2Fcdk-django","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbriancaffey%2Fcdk-django","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbriancaffey%2Fcdk-django/lists"}