{"id":15601161,"url":"https://github.com/hacknlove/plisplas","last_synced_at":"2025-09-01T12:08:35.624Z","repository":{"id":50500966,"uuid":"519159880","full_name":"hacknlove/plisplas","owner":"hacknlove","description":"Simple graphql and REST framework, that does not get in your way.","archived":false,"fork":false,"pushed_at":"2022-08-03T07:33:25.000Z","size":210,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-09T03:56:34.477Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/hacknlove.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}},"created_at":"2022-07-29T09:39:02.000Z","updated_at":"2024-04-25T02:45:58.000Z","dependencies_parsed_at":"2022-09-19T12:11:10.708Z","dependency_job_id":null,"html_url":"https://github.com/hacknlove/plisplas","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hacknlove/plisplas","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hacknlove%2Fplisplas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hacknlove%2Fplisplas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hacknlove%2Fplisplas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hacknlove%2Fplisplas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hacknlove","download_url":"https://codeload.github.com/hacknlove/plisplas/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hacknlove%2Fplisplas/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273122121,"owners_count":25049539,"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","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-10-03T02:18:57.083Z","updated_at":"2025-09-01T12:08:35.566Z","avatar_url":"https://github.com/hacknlove.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# plisplas\n\nLight and simple DDD framework for making modules, GraphQL, REST that does not get in your way, and just help you wire up your exports, resolvers and controllers.\n\n## Introduction.\n\nIt is a pain to have to set everything up and to maintain huge domainless files that look like monoliths, where you need to import all the resolvers, controllers, etc.\n\nIt would be nice to have a bit of convention over configuration, so you can drop your controllers and resolvers files with obvious names in obvious directories, and to have a build tool taking care of the rest.\n\nThis is what plisplas is about.\n\n## Quick start\n```sh\nnpm init plisplas your-project-name\ncd your-project-name\nnpm run dev\n```\n\n## Peer Dependencies\nIf you want to use HTTP endpoints, you need to install the following dependencies\n```\nnpm i cors deepmerge express\n``` \n\nIf you intend to use GraphQL endpoints, you have to install all the following dependencies\n```\nnpm i apollo cors deepmerge express graphql\n```\n\n### npm scripts\n\n#### `npm run dev`\nIt watches changes on the source, build  it, and start a server (if needed).\n\n#### `npm run build`\nIt builds the human-readable source code version of plisplas at `./plisplas` and then it transpile all the source code to `./dist` \n\nIt also updates your `package.json` to set the `exports` if needed`\n\n#### `npm start`\nIt starts the server.\n\n\n## domains directory\n\nThis is the only directory plisplas will look for exports, REST endpoints, and GraphQL schemas, types, fields, queries and mutations.\n\nSuit yourself, organizing your files however you want.\n\nYou just need to follow some suffix conventions to allow plisplas to do the tedious and boring stuff for you.\n\n    `.get.js` HTTP GET  endpoint\n    `.post.js` HTTP POST endpoint\n    `.delete.js` HTTP DELETE endpoint\n    `.put.js` HTTP PUT endpoint\n    `.path.js` HTTP PATCH endpoint\n    `.all.js` catch all method for HTTP endpoint\n    `.query.js` GraphQL Query\n    `.mutation.js` GraphQL Mutation\n    `.type.js` GraphQL Type\n    `.field.js` GraphQL field for a type\n    `.export.js` JavaScript module export\n\n\n## Module exports\n Any file inside the `domain` that matches `\\.export\\.m?[tj]s` will be transpiled and exported.\n\nThe path of the file will determine the path of the export.\n* *the file `/domains/foo/bar/baz.export.js` will be exported like `[package-name]/foo/bar/baz`*\n* *the file `/domains/foo/index.export.js` will be exported like `[package-name]/foo*\n\nAnd all then will also be exported in a combined object as `[package-name]` so the importer can do introspection.\n\n### Import examples\n```js\nimport baz from '[package-name]/foo/bar/baz'\n\nconst foo = require('[package-name]/foo')\n\nimport packageName from 'package-name`\n//  packageName.foo.bar.baz\n ```\n\n## REST endpoints\nAny file that matches `/(get|post|put|patch|all).m?[tj]s$/i` will be handling a REST endpoint.\n\n### Path-to-route rules:\n#### Basic routing:\nThe route of the endpoint will be determined by the file path of the file inside domains.\n\n*The file `/domains/foo/bar/baz.get.js` will be handling the `GET` requests to the route `/foo/bar/baz`*\n\n#### index files\nThe filename of the index files will not be considered for the route.\n\n*The file `/domains/foo/bar/index.get.js` will be handling the `GET` requests to the route `/foo/bar`*\n\n#### Root:\nif the path includes `_root_` this will be taken as the root of the route.\n\n*The file `/domains/foo/_root_/bar/baz.post.js` will be handling the `POST` requests to the route `/bar/baz`*\n\n#### Route parameters:\n\nif any path segment is surrounded by brackets, it will be a named route parameter.\n\n*The file `/domains/foo/[bar]/baz.PUT.ts` will be handling the `PUT` requests to the express route `/foo/bar/baz`*\n\n### express configuration\n\n To modify the middlewares, that are added to the express app before the routes, you can add more items to the `config.express.use` array; or override the default ones,\n\nYou can change the port, IP\n\nYou can add more items to `config.express.routes` array, or override the default ones, to modify the routes.\n\n## GraphQL\n\nThe files matching `/(query|mutation|type|field)\\.m?[tj]s$/i` will be handled as resolvers.\nThe files matching `/\\graphql` will be handled as schema definition.\n\n### path to resolver rules:\n\nThere are no specific rules for the `.graphql` files.\n\nThose files are just appended together in a single `schema.graphql` file.\n\n#### Query, Mutation and Type naming.\n\nThe name of the type, query or mutation, will be determined by the filename, unless the filename is an index, in which case the name will be the parent directory name.\n\n#### field naming\n\nThe name of the field will be determined by the filename, and the name of the type it belongs to will be determined by the directory name.\n\nIf the field’s file is an index file, the name of the field will be `index`.\n\n#### configuration\n\n`configuration.apollo` will be passed as the parameter to the Apollo Server constructor, so you can do whatever you want.\n\n\n## configuration\n\nA plisplas service can be configured with a `plisplas.config.js` file.at the root of the project.\n\nThis file is transpiled by tsc, so any syntax it supports can be used.\n\nIt can default-export a configuration object, or a function that accepts the default configuration object and returns the desired configuration object, or its promise.\n\nIn the case of exporting an object, it will be merged with the default configuration object.\n\n### default configuration\n\n```js\nexport default {\n  express: {\n    ip: '0.0.0.0',\n    port: 5000,\n    use: [\n      express.json(),\n    ],\n    routes // array with the parsed routes,\n  },\n  apollo: {\n    csrfPrevention: true,\n    resolvers // object with the parsed resolvers,\n    typeDefs // string with the parsed typeDefs,\n    plugins: [\n      process.env.NODE_ENV === 'production'\n      ? ApolloServerPluginLandingPageDisabled()\n      : ApolloServerPluginLandingPageGraphQLPlayground(),\n    ],\n  }\n}\n```\n\n## Custom server\n\nIf you need further customizations, you can create your own custom server.\n\nYou might want to use the files `plisplas/routes.js` and maybe `plisplas/useRouters.js` to  add the routes to your express application.\n\nYou might want to use the files `plisplas/schema.graphql` and `plisplas/resolvers.js` to add the schema to your Apollo Server\n\nand you will need to change your `package.json/scripts/start` to point to your custom server entry point.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhacknlove%2Fplisplas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhacknlove%2Fplisplas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhacknlove%2Fplisplas/lists"}