A simple headless CMS for AWS serverless infrastructure. API uses API Gateway, Lambda and DynamoDB while Admin interface uses S3.
Note: THIS PROJECT IS NOW DISCONTINUTED IN FAVOR OF Abu CMS!
I needed a CMS to manage my web/app projects but I wanted it to be as cheap as possible (if not free) since most of them are websites that doesn't change too much. In addition to that, I also wanted to have full control over the source code so that I can use it as a starting point for my larger projects.
I looked at strapi but unfortunately it needs a server to work. And having a server means that it will cost money to run. A cost which is more than what I am willing to spend.
So my solution is to use serverless technology. Except for API Gateway, all of the other services the CMS will use have an "Always free" tier in AWS. API Gateway has a 1 million request per month free for 12 months. So this means as long as you do not exceed the free tier limits, the CMS will be free for 1 year then on the second year on wards you'll just be paying a few cents.
-
Clone this repository
-
Install aws-cli and create a profile.
aws configure --profile kdc
As a safety precaution, I usually set my default credentials as a fake account like so:
[default] aws_access_key_id=fake aws_secret_access_key=fake [kdc] aws_access_key_id=xxxxxxx aws_secret_access_key=xxxxxxxx
-
Install serverless binary
sudo npm i -g serverless
-
Install project dependencies.
cd kdc-cms yarn install
-
Install docker for running dynamodb-local and dynamodb-manager on your machine.
-
Setup database and create initial user.
yarn setup local
-
Start API and CMS
yarn start
Endpoints:
- http://localhost:8100 - KDC CMS
- http://localhost:8101 - API endpoint
- http://localhost:8102 - Dynamodb manager
- http://localhost:8103 - Dynamodb-local
- http://localhost:8104 - S3 local
-
Run API tests
yarn test:api
-
Run Admin Cypress tests
Before running admin test, edit the file
packages/kdc-cms-admin/cypress.json
and change the email and password to match what entered in the setup.Terminal 1:
yarn start
Terminal 2:
yarn test:admin
KDC CMS can be deployed in different stages. Example is dev
and prod
. Each stage will have different resources. Don't worry it will not cost you anything as one of the advantages of serverless is pay as you use. There will be no idle servers that you need to pay for.
Make sure you replace $stage
with dev
, staging
or prod
to denote different stages of your app.
-
Create dynamodb table and create initial user.
yarn setup $stage
-
Deploy API package:
yarn deploy:api $stage
-
Deploy Admin package:
yarn deploy:admin $stage
-
If you want to undo setup and deployment:
yarn delete $stage
Note that this cannot be undone. Please be careful!
- gatsby-source-kdc-cms - Full working example using this plugin, see gatsby-blog-kdc-cms
- Does not work on MS Windows. I am open to contributions.
If you find this project useful, please consider giving a star. I would really appreciate it.
You can also: