{"id":18718332,"url":"https://github.com/worldbrain/analytics-backend","last_synced_at":"2025-07-06T17:04:50.411Z","repository":{"id":97337165,"uuid":"134084518","full_name":"WorldBrain/analytics-backend","owner":"WorldBrain","description":"API Server for Custom Analytics","archived":false,"fork":false,"pushed_at":"2019-04-13T10:27:24.000Z","size":66,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-07-02T20:31:30.825Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WorldBrain.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-05-19T17:42:24.000Z","updated_at":"2021-07-30T17:35:11.000Z","dependencies_parsed_at":"2023-06-30T00:16:42.456Z","dependency_job_id":null,"html_url":"https://github.com/WorldBrain/analytics-backend","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/WorldBrain/analytics-backend","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WorldBrain%2Fanalytics-backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WorldBrain%2Fanalytics-backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WorldBrain%2Fanalytics-backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WorldBrain%2Fanalytics-backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WorldBrain","download_url":"https://codeload.github.com/WorldBrain/analytics-backend/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WorldBrain%2Fanalytics-backend/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263940256,"owners_count":23533008,"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":[],"created_at":"2024-11-07T13:20:39.137Z","updated_at":"2025-07-06T17:04:50.390Z","avatar_url":"https://github.com/WorldBrain.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Serverless api endpoints using AWS lambda and AWS s3 for Analytics\n\nThis is the repository for the analytics of the memex - How the users intreacts with memex extension.\n\n# Installation\nFork the repo\n```sh\n$ git clone https://github.com/WorldBrain/AnalyticsServer.git\n```\n\nInstall all the dependencies\n```sh\n$ npm install\n```\n\nRename .env.example to .env and change all the required things,\n\n## Run without AWS (Development setup)\nIn the .env, change \n```sh\nTIER=\"development\"\n```\nAll the users and events will be saved in the `public` folder.\n\n## Run with AWS\n\nInstall the [aws-cli](https://docs.aws.amazon.com/cli/latest/userguide/installing.html) and configure `aws configure`\n\nConfigure with AWS account\n```sh\n$ npm run config -- --account-id=\"12_DIGIT_ACCOUNT_ID\" --bucket-name=\"UNIQUE_BUCKET_NAME\" --function-name=\"LAMBDA_FUNCTION_NAME\" --region=\"REGION\" --stage=\"YOUR_STAGE_NAME\" --stack-name=\"YOUR_AWS_STACK_NAME\"\n```\n\nFor example\n```sh\n$ npm run config -- --account-id=\"12_DIGIT_ACCOUNT_ID\" --bucket-name=\"UNIQUE_BUCKET_NAME\" --function-name=\"LAMBDA_FUNCTION_NAME\" --stage=\"staging\" --stack-name=\"YOUR_AWS_STACK_NAME\"\n```\nOR\n```sh\n$ npm run config -- --account-id=\"12_DIGIT_ACCOUNT_ID\" --bucket-name=\"UNIQUE_BUCKET_NAME\" --function-name=\"LAMBDA_FUNCTION_NAME\" --stage=\"production\" --stack-name=\"YOUR_AWS_STACK_NAME\"\n```\n\nThe default function name and region are\n```sh\nregion: 'us-east-1',\nfunction-name: 'AwsServerlessExpressFunction',\nstack-name: 'AwsServerlessExpressStack'\n```\n\nNow you can deploy the serverless application to AWS\n\n```sh\n$ npm run prepare\n$ npm run setup\n```\n\nNow we have two endpoints:\n\u003e /user-token/ - POST\n- install_time: timestamp\n\n\u003e /event/ - POST\n  - id: string\n  - data: array of events\n\nEach element of data contains:\n  - type\n  - time\n  - other : Array of additional things - reserved for future\n\n# Deploy\nDeconfigure first by ruuning\n```sh\nnpm run deconfig\n```\n\nNow config the file according to need\n\n## Deploy in staging\n```sh\n$ npm run config -- --account-id=\"12_DIGIT_ACCOUNT_ID\" --bucket-name=\"staging.analytics.worldbrain.io\" --function-name=\"stagingAWSAnalytics\" --stage=\"staging\" --stack-name=\"StagingStack\"\n$ npm run setup\n```\n\nIt will create the stack named as configure input.\n\n## Deploy in production\n```sh\nnpm run config -- --account-id=\"12_DIGIT_ACCOUNT_ID\" --bucket-name=\"analytics.worldbrain.io\" --function-name=\"AWSAnalytics\" --stage=\"production\" --stack-name=\"ProductionStack\"\n```\n\nIt will create the stack named as configure input.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworldbrain%2Fanalytics-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fworldbrain%2Fanalytics-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fworldbrain%2Fanalytics-backend/lists"}