Skip to content

Commit

Permalink
feat: add instance service (#510)
Browse files Browse the repository at this point in the history
Signed-off-by: hxtree <[email protected]>
  • Loading branch information
hxtree authored Nov 10, 2023
1 parent 8dcb887 commit c3505a8
Show file tree
Hide file tree
Showing 32 changed files with 1,396 additions and 2 deletions.
6 changes: 5 additions & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'scope-enum': [2, 'always', ['character', 'platform', 'user', 'library']],
'scope-enum': [
2,
'always',
['character', 'platform', 'user', 'library', 'deps'],
],
'type-enum': [
2,
'always',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@cats-cradle/nestjs-modules",
"comment": "",
"type": "none"
}
],
"packageName": "@cats-cradle/nestjs-modules"
}
139 changes: 139 additions & 0 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion common/config/rush/repo-state.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush.
{
"pnpmShrinkwrapHash": "35dba17277aaf467f308553d1ab16371c6243f4b",
"pnpmShrinkwrapHash": "1bc5aceff8d614bebbd5f8c51cfef9dd3a538497",
"preferredVersionsHash": "8ae0ba5bd02ec9c5763773a15e27aee08a6567f6"
}
12 changes: 12 additions & 0 deletions rush.json
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,18 @@
"@cats-cradle/create-bundle"
],
"tags": ["service-package", "deploy-app"]
},
{
"packageName": "@cats-cradle/instances",
"projectFolder": "services/instances",
"reviewCategory": "apis",
"decoupledLocalDependencies": [
"@cats-cradle/eslint-config",
"@cats-cradle/nestjs-modules",
"@cats-cradle/create-artifact",
"@cats-cradle/create-bundle"
],
"tags": ["service-package", "deploy-app"]
}
]
}
11 changes: 11 additions & 0 deletions services/instances/.env.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
AWS_ACCOUNT_ID=123456789012
AWS_REGION=us-east-2
STAGE_NAME=default
BASE_URL=unknown

APP_NAME=instance
ENVIROMENT=local

MONGO_DATABASE_URI=
MONGO_DATABASE_USER=
MONGO_DATABASE_PASSWORD=
6 changes: 6 additions & 0 deletions services/instances/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
extends: ['@cats-cradle/eslint-config/profile/base'],
parserOptions: {
tsconfigRootDir: __dirname,
},
};
15 changes: 15 additions & 0 deletions services/instances/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# cats-cradle/instances

[![GitHub Stars](https://img.shields.io/github/stars/hxtree/cats-cradle?style=social)](https://github.com/hxtree/cats-cradle/stargazers)

This service tracks instances. A instance is a unique Id used to define
boundaries of other systems. Other than when it was created and whether it
exists, not much else is managed by this service.

For example, when playing a game each user could be assigned to an instance. If
two or more players were assigned to the same instance, they would share the
game experience. Meaning what happens in one users game would happen in the
others user game.

This concept can be applied to many other business use cases, but the service is
primarily useful for maintaining isolation of data that spans multiple services.
6 changes: 6 additions & 0 deletions services/instances/bin/app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env node
import * as cdk from 'aws-cdk-lib';
import { InstanceStack } from '../stacks/instance.stack';

const app = new cdk.App();
new InstanceStack(app, 'InstanceStack');
17 changes: 17 additions & 0 deletions services/instances/cdk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"app": "create-bundle && npx ts-node --prefer-ts-exts bin/app.ts",
"watch": {
"include": ["src/", "stacks/"],
"exclude": ["__tests__", "*.test.ts", "*.e2e-spec.ts"]
},
"context": {
"@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId": true,
"@aws-cdk/core:stackRelativeExports": true,
"@aws-cdk/aws-rds:lowercaseDbIdentifier": true,
"@aws-cdk/aws-lambda:recognizeVersionProps": true,
"@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021": true,
"@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true,
"@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true,
"@aws-cdk/core:target-partitions": ["aws", "aws-cn"]
}
}
11 changes: 11 additions & 0 deletions services/instances/jest-mongodb-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
mongodbMemoryServerOptions: {
binary: {
version: '6.0.0',
skipMD5: true,
},
instance: {},
autoStart: false,
},
mongoURLEnvName: 'MONGO_DATABASE_URI',
};
3 changes: 3 additions & 0 deletions services/instances/jest.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"preset": "./node_modules/@cats-cradle/base-nodejs/profiles/nestjs-app/jest.config.json"
}
Loading

0 comments on commit c3505a8

Please sign in to comment.