Skip to content

Commit

Permalink
Cleanup templates further (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
IMax153 authored Sep 12, 2024
1 parent 5aadbbd commit 88bf05d
Show file tree
Hide file tree
Showing 42 changed files with 248 additions and 536 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
# Work In Progress
# Effect Examples

This repository serves as a centralized location for both examples of how to use Effect in real-world projects as well as templates for quickly bootstrapping projects with Effect.

## Create Effect App

The repository also contains a command-line application called `create-effect-app`, which can be used to bootstrap an example or a template in a single command.

See [the documentation](./packages/create-effect-app/README.md) for more information.
1 change: 1 addition & 0 deletions examples/http-server/.envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
3 changes: 0 additions & 3 deletions examples/http-server/.prettierignore

This file was deleted.

3 changes: 3 additions & 0 deletions examples/http-server/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
}
122 changes: 0 additions & 122 deletions examples/http-server/eslint.config.mjs

This file was deleted.

90 changes: 0 additions & 90 deletions examples/http-server/flake.lock

This file was deleted.

42 changes: 17 additions & 25 deletions examples/http-server/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@
process-compose-flake.url = "github:Platonic-Systems/process-compose-flake";
services-flake.url = "github:juspay/services-flake";
};

outputs = inputs @ {flake-parts, ...}:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = inputs.nixpkgs.lib.systems.flakeExposed;

imports = [
inputs.process-compose-flake.flakeModule
];

perSystem = {pkgs, ...}: {
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
Expand All @@ -27,31 +24,26 @@
inputs.services-flake.processComposeModules.default
];

services = {
tempo.tempo.enable = true;

redis.redis.enable = true;

grafana.grafana = {
enable = true;
http_port = 4000;
extraConf = {
"auth.anonymous" = {
enabled = true;
org_role = "Editor";
};
services.tempo.tempo.enable = true;
services.grafana.grafana = {
enable = true;
http_port = 4000;
extraConf = {
"auth.anonymous" = {
enabled = true;
org_role = "Editor";
};
datasources = with config.services.tempo.tempo; [
{
name = "Tempo";
type = "tempo";
access = "proxy";
url = "http://${httpAddress}:${builtins.toString httpPort}";
}
];
};
datasources = with config.services.tempo.tempo; [
{
name = "Tempo";
type = "tempo";
access = "proxy";
url = "http://${httpAddress}:${builtins.toString httpPort}";
}
];
};

services.redis.redis.enable = true;
settings.processes.tsx = {
command = "pnpm dev";
};
Expand Down
51 changes: 20 additions & 31 deletions examples/http-server/package.json
Original file line number Diff line number Diff line change
@@ -1,49 +1,38 @@
{
"name": "http-server",
"version": "0.0.0",
"version": "1.0.0",
"type": "module",
"description": "",
"scripts": {
"check": "tsc -b tsconfig.json",
"dev": "tsx --env-file=.env --watch src/main.ts",
"test": "vitest"
},
"packageManager": "[email protected]",
"dependencies": {
"@effect/experimental": "^0.24.0",
"@effect/opentelemetry": "^0.36.0",
"@effect/platform": "^0.63.0",
"@effect/platform-node": "^0.58.0",
"@effect/schema": "^0.72.0",
"@effect/sql": "^0.10.0",
"@effect/sql-sqlite-node": "^0.10.0",
"@opentelemetry/exporter-trace-otlp-http": "^0.53.0",
"@opentelemetry/sdk-trace-base": "^1.26.0",
"@opentelemetry/sdk-trace-node": "^1.26.0",
"effect": "^3.7.2",
"uuid": "^10.0.0"
},
"keywords": [],
"author": "",
"packageManager": "[email protected]",
"devDependencies": {
"@effect/eslint-plugin": "^0.2.0",
"@effect/language-service": "^0.1.0",
"@effect/vitest": "^0.9.2",
"@eslint/compat": "^1.1.1",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.9.1",
"@effect/vitest": "^0.9.1",
"@types/node": "^22.5.3",
"@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^8.4.0",
"@typescript-eslint/parser": "^8.4.0",
"eslint": "^9.9.1",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-codegen": "^0.28.0",
"eslint-plugin-deprecation": "^3.0.0",
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-sort-destructure-keys": "^2.0.0",
"prettier": "^3.3.3",
"tsup": "^8.2.4",
"tsx": "^4.19.0",
"typescript": "^5.5.4",
"vitest": "^2.0.5"
},
"dependencies": {
"@effect/experimental": "^0.24.1",
"@effect/opentelemetry": "^0.36.1",
"@effect/platform": "^0.63.1",
"@effect/platform-node": "^0.58.1",
"@effect/schema": "^0.72.1",
"@effect/sql": "^0.10.1",
"@effect/sql-sqlite-node": "^0.10.1",
"@opentelemetry/exporter-trace-otlp-http": "^0.53.0",
"@opentelemetry/sdk-trace-base": "^1.26.0",
"@opentelemetry/sdk-trace-node": "^1.26.0",
"effect": "^3.7.1",
"uuid": "^10.0.0"
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "@effect/platform"
import { Schema } from "@effect/schema"
import { security } from "../Api/Security.js"
import { Unauthorized } from "../Domain/Policy.js"
import { User, UserIdFromString, UserNotFound, UserWithSensitive } from "../Domain/User.js"
import { security } from "./Security.js"

export class AccountsApi extends HttpApiGroup.make("accounts").pipe(
HttpApiGroup.add(
Expand Down
2 changes: 1 addition & 1 deletion examples/http-server/src/Accounts/Policy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Effect, Layer } from "effect"
import { policy } from "../Domain/Policy.js"
import type { policy } from "../Domain/Policy.js"
import type { UserId } from "../Domain/User.js"

// eslint-disable-next-line require-yield
Expand Down
6 changes: 3 additions & 3 deletions examples/http-server/src/Api.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { HttpApi, OpenApi } from "@effect/platform"
import { AccountsApi } from "./Api/Accounts.js"
import { GroupsApi } from "./Api/Groups.js"
import { PeopleApi } from "./Api/People.js"
import { AccountsApi } from "./Accounts/Api.js"
import { GroupsApi } from "./Groups/Api.js"
import { PeopleApi } from "./People/Api.js"

export class Api extends HttpApi.empty.pipe(
HttpApi.addGroup(AccountsApi),
Expand Down
Loading

0 comments on commit 88bf05d

Please sign in to comment.