Code Monkey home page Code Monkey logo

taitounited / full-stack-template Goto Github PK

View Code? Open in Web Editor NEW
34.0 34.0 8.0 21.06 MB

Template for cloud-native applications and microservices running as containers/functions on Kubernetes, Docker Compose, or cloud. You can choose the stack during project creation.

Home Page: https://taitounited.github.io/taito-cli/templates

License: MIT License

Shell 20.78% CSS 0.34% JavaScript 6.29% PLpgSQL 0.46% HCL 4.75% Dockerfile 1.70% TypeScript 59.20% Java 0.61% HTML 0.25% Python 5.63%
cloud-native full-stack kubernetes nodejs postgres react serverless taito-template template

full-stack-template's People

Contributors

absor avatar antipaste avatar einarituukkanen avatar janim avatar jonesus avatar joonardo avatar joonasgalab avatar jtjuslin avatar julientexier avatar keskiju avatar ottotakkinen avatar pesukone avatar taavettik avatar temzasse avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

full-stack-template's Issues

Improve logging

  • If COMMON_LOG_FORMAT is 'text', still use the StackdriverStream, but print in human readable format (e.g. with this https://github.com/benbria/bunyan-debug-stream). On local development the human readable format is currently achieved with | bunyan -l debug on server/package.json.
  • Prune useless logging (already done?)
  • All API validation errors should leave an informative message to log (see issue #7) (already done?)
  • Show db connection pool status on log in addition to request latency

Python backend(s)

Implement some python backend(s) in alternatives/:

  • Flask with uWSGI: alternatives/server-flask
  • Bottle with uWSGI: alternatives/server-bottle (use the existing server-flask as an example).
  • FastAPI (or plain starlette): alternatives/server-fastapi
  • (optional: Django with uWSGI: alternatives/server-django )
  • (optional: Tornado: alternatives/server-tornado )

Each stack component must provide at least the following. Copy these from server/ and modify.

  • Dockerfile: Dockerfile for local development
  • Dockerfile.build: Dockerfile for building docker images for server environments. It should contain a build stage that is named builder.
  • test-suites: List of api/e2e test suites.
  • test.sh: Shell script that runs a test suite or a single test based on given parameters.
  • Good conventions (folder structure, file naming, etc)
  • Working blog example as implemented in full-stack-template.
  • README.md: Instructions for configuring the stack component for a project (if instructions are required).

Additional server requirements - Mandatory:

  • Health check: Public endpoint /healthz should check that the server container is running ok. Return HTTP 200 response if everything is ok.
  • Uptime check: Public endpoint /uptimez should check that the server container is running ok, and all external systems (e.g. database) are also reachable. Return HTTP 200 response if everything is ok.
  • Logging formats: text logging format for local development and stackdriver logging format (json) for server environments. See log.util.js as an example. NOTE: Do not log all request headers, as they might contain secrets.

Additional server requirements - Optional:

  • Config values for clients: Public endpoint /config should return such config values that are required by clients (e.g. web UI). NOTE: Do not return any secrets or confidential configs!
  • Latency logging: Log latency of each response. See log.util.js as an example.
  • DB pool status logging: pool size, number of reserved connections.
  • Error ids: For each system error, return a generated error id in the response that can be used to find the error details from log.
  • Sentry integration: See sentry.setup.js as an example.

Upgrade semantic-release to the latest version

There are some breaking changes, I think. Upgrade semantic-release of all these projects:

Current implementation is described below:

Once changes are merged to master, taito-cli semantic plugin sets the GH_TOKEN environment variable and runs:

  • npm run release-pre:prod before build to determine new version number from commit messages.
  • npm run release-post:prod after build to tag git repository and publish release notes.

NOTE: merge must include at least one feat or fix commit or otherwise npm run release-pre:prod will fail.

Example tests

  • Replace Mocha with Jest on server?
  • Unit tests (formatters.unit.ts suffices for server, add also one unit test example for client)
  • API tests (dummy posts test already exists -> improve it)
  • Snapshot API tests with Jest
  • e2e tests (cypress)

TypeScript support

See stack configuration.

Should be implemented the same way as flow support:

  • Provide example tsconfigs and other ts settings that are marked with NOTE: for typescript.
  • Provide a script that renames all js files to ts. At the beginning tslint settings should allow omitting any so that this is possible. The settings can be changed later.
  • Provide some of the example implementations in ts format with typings. For example, one service implementation and one page with react components.

Linux node_modules volume fix

The "/DIR/node_modules" volumes of docker-compose.yaml do not work on Linux correctly if the node_modules directory does not exist on host when starting up docker-compose.

Somehow make sure that ./DIR/node_modules exists on host when starting a container. Perhaps check if node_modules is empty or does not exist on start (CMD command of Dockerfile), and print some error message.

API validation and API documentation generation

Swagger + swagger documentation tools might be a bit overkill for small projects. It also brings about some constraints and therefore might not work very well with HTTP/2 push and hypermedia (links), and does not support GraphQL.

A more lightweight approach would be:

  • joi or json schema for REST API validation + some tool that generates markdown from schemas? (Popular koa plugins exists for these? Or should be review the new fastify framework that provides these out-of-the-box?)
  • GraphQL schemas for GraphQL validation + some tool that generates markdown from schemas?
  • Markdown files + static site generator for documentation: gatsby or slate. Slate seems nice but people seem to be moving from slate to more multi-purpose static-site-generators like gatsby.

Markdown files should be placed at docs/ and static site generator implementation is already at www/.

asciidoc might be a better format for technical documentation than markdown. However, markdown is more familiar for people and probably good enough for most cases. Perhaps we can support both.

Move .htpasswd to secrets

In addition, for projects that use basic auth in production, change the password and move it to 1password.

Proper blog example

Implement a proper blog example that demonstates different technologies.

Media:

  • Add/remove media files (demonstrates file upload/download and storage buckets)
  • Generate thumbnails and previews for media files (demonstrates background jobs implemented as Kubernetes jobs)
  • Select a media file for blog post

Posts:

  • Show new blog posts automatically in real-time (demonstrates websockets and postgresql notifications)
  • Generate blog post PDF using a server-side pdf template (demonstrates POD)
  • Generate blog post PDF using react web ui as a template (e.g. headless chrome or some other mechanism)
  • Alternative GraphQL example (demonstrates GraphQL)
  • Also some cron job example? (demonstrates cron jobs)

Deprecated typography variants

From browser console: Warning: Material-UI: you are using the deprecated typography variants that will be removed in the next major release. Please read the migration guide under https://material-ui.com/style/typography#migration-to-typography-v2

Change secret naming convention

Related to TaitoUnited/taito-cli#62

Also support multiple values for one kube secret (e.g. key, secret)

Also rename db build secret to mgr.

PROJECT-(ENV)-TYPE-PURPOSE:
- server-template-db-app
- server-template-db-build
- server-template-storage-gateway
- server-template-gcloud-account
- server-template-jwt-secret
- server-template-admin-password
- server-template-user-password

Vue client

Implement vue client in alternatives/client-vue.

Requirements:

Copy these from server-template/client and modify if required:

  • Dockerfile: Dockerfile for local development
  • Dockerfile.build: Dockerfile for building docker images for server environments. It should contain a build stage that is named builder.
  • test-suites: List of api/e2e test suites.
  • test.sh: Shell script that runs a test suite or a single test based on given parameters.
  • cypress.json and test/: working cypress test example.
  • README.md: Instructions on how to initialize new vue project with vue-cli.

Optional example implementation:

  • Working blog example as implemented in server-template/client.
  • Sentry integration: See logger.utils.js as an example.

Use yarn instead of npm?

Currently yarn does not provide anything extra that we would need, but this might change with issue #18.

Move this issue to npm-template?

Example implementation for backend

NOTE: These examples are meant to be reusable, and thus must be of good quality (requires senior developer supervision).

Including validation, error handling, logging and API document generation. And preliminary authentication for development purposes.

Related to #7 and #13.

Use the latest react/webpack/js conventions

Once React with hooks support is out, we should the following:

  • Convert React components to functions and use hooks
  • Replace redux with hooks?
  • Should we use create-react-app or not? Good for quick start but not that versatile as it hides webpack?
  • Use service worker
  • Make hot module replacement work again
  • Code splitting (nowadays React API provides support for code splitting?)
  • Use fetch instead of axios?
  • Reduce bundle size by removing unnecessary libs like lodash. (Redux uses lodash also? Does removing lodash really help?)
  • Sanitize eslint rules (use plugin recommendation settings instead of custom rules)

Replace deprecated validate-commit-msg with CommitLint

Currently validate-commit-msg library is being used for validating all commit messages. It is deprecated and therefore should be replaced with CommitLint.

Do the same for all of these:

NOTE: You might need to remove old git hooks set by validate-commit-msg. Or just take a fresh clone of the git repository and do not run taito install until you have removed validate-commit-msg and husky

Vue admin

Implement vue admin in alternatives/admin-vue. See also #27.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.