New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

commun

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

commun - npm Package Compare versions

Comparing version 0.3.7 to 0.3.8

2

package.json
{
"name": "commun",
"version": "0.3.7",
"version": "0.3.8",
"description": "🎩 No-code platform for creating scalable backends for communities and user based apps",

@@ -5,0 +5,0 @@ "repository": {

# Commun
With Commun you can build complete backends for communities and user based apps **without coding**.
With Commun you can build powerful backends for communities and user based apps **without coding**.
Commun helps you build scalable APIs in hours instead of months by giving you powerful tools to model your app in a
graphic UI.
Commun helps you build scalable APIs in hours instead of months by giving you powerful tools to model your app in a graphic UI.
**[Documentation](https://commun.dev/docs/introduction)**.
## Key Features
- Supports **GraphQL** and **REST API** out of the box
- Secure authentication with email and password or third party systems (Google, Facebook and GitHub)
- Fully-featured user and permissions management
- Fast full-text search
- UI Dashboard for managing the entire application without coding
- Create the entities and custom attributes that your app needs
- Use hooks for performing operations in response of lifecycle events
## Installation
#### Quick start
You need to install [Node.js](https://nodejs.org/en/download/) and [MongoDB](https://docs.mongodb.com/manual/installation/) first, then just run:

@@ -29,145 +19,56 @@

#### create-commun-app options
## Features
```
npx create-commun-app --help
Usage: create-commun-app [options] <app-directory>
Options:
-V, --version output the version number
--dbname <dbname> MongoDB database name (defaults to <app-directory>)
--dbhost <dbname> MongoDB host (default: "localhost")
--dbport <dbname> MongoDB port (default: "27017")
-d, --debug output extra debugging
-p, --port <port> Port used by the server (default: 3000)
-h, --help output usage information
```
## Dashboard
![Commun Dashboard](https://i.imgur.com/OfssVs1.png)
Commun comes with a complete dashboard that you can use to manage your application without having to write any code.
The dashboard also works perfectly on mobile devices, so you can manage your app on the go.
## Documentation
### Entities
Entities represent the components of your application, for example: Posts, Comments, Votes.
**Provided APIs:**
* `[GET] /api/v1/:entity`
- Returns a paginated list of items in the entity, where :entity is the name of your entity
- Use `?sort=attr:asc` query string to sort the items given an attribute.
- Use `?filter=attr1:bar;attr2:foo` query string to filter the items given attributes and values
- It only returns items to users with the right GET permission
- For each item, it only returns the attributes with the user has the right GET permission
* `[POST] /api/v1/:entity`
- Creates a new item sending the attributes in the body
- The user needs to have the right CREATE permission
- Only attributes with the right CREATE permission are set
* `[GET] /api/v1/:entity/:key`
- Returns a single item given its ID or the attribute used to identify the entity.
- It only returns the item if the user has the right GET permission
- It only returns the attributes allowed by the GET permission
### 🚀 GraphQL and REST API support
- Commun automatically prepares a GraphQL and Rest API backend which you can consume from anywhere.
- Use your Commun backend to provide your entire frontend or use it to extend your existing application.
* `[PUT] /api/v1/:entity/:key`
- Updates a single item with the attributes in the request body
- The user needs to have the right UPDATE permission
- Only attributes with the right UPDATE permission are updated
### 🔑 Secure authentication & role based permission management
- Commun provides secure authentication and role based permission management out of the box.
- Your users can create accounts using email and password or third party systems like Google, Facebook or GitHub.
### 🤩 Lifecycle Hooks
- Hooks allow you to perform actions as responses to lifecycle events on any item.
### 🔎 Fast full-text search
- Text indexes allow you to create full-text search APIs.
- They can run on one or more attributes.
- Not all attributes are equally important. You can optionally set weights on each one to provide better search results.
### 🎚 UI Dashboard
- Manage your entire application without coding using the mobile-friendly dashboard.
### 📧 Emails
- Send emails to your users in response to events.
- Create templates with custom variables to personalize the experience of your users.
- Welcome email, email verification and password change verification come by default.
* `[DELETE] /api/v1/:entity/:key`
- Deletes a single item
- The user needs to have the right DELETE permission
### 🔌 Pluggable
- Commun was built as a set of optional plugins that can be easily integrated.
- Features like users, dashboard, emails and GraphQL are just plugins.
All these features live in different npm packages and can be installed/uninstalled as needed.
#### Entity Permissions
## Use Cases
You can specify entity or attribute level permissions. Commun supports GET, CREATE, UPDATE and DELETE permissions.
Commun can be used to create any kind of application, but it can be extra helpful for creating applications in which the
users can create content or any kind of contributions.
For every permission type you can specify the following values:
- **Anyone**: There are no restrictions on the action.
- **Any authenticated user**: Any user that is authenticated in your application can perform the action.
- **The same user**: Only supported by entities that have an attribute with type `user`, which stores an user ID. Only the authenticated user with the same ID can perform the action.
- **Administrators**: Only users marked as administrators can perform the action.
- **Only the system**: Only the system can perform the action.
Some examples include:
#### Entity Attributes
- Content sharing platforms
- Forums or discussion boards
- Social networks
- Job boards
- Property listing platforms
- Reviews sharing platforms
- Events listing platforms
Entities have a list of attributes that represent the different values your component can store.
## Dashboard
Attributes can have the following types:
- Boolean: Value can only be true or false.
- Email: Value can only be a valid email address.
- Enum: Value can only be in a specified list of accepted values.
- Number: Value can only be a number.
- Entity Reference: Value can only be an ID referencing a different entity.
- Slug: Transforms the value of a different attribute to a url friendly value.
- String: Value can only be a string.
- User: Value can only be an user ID.
![Commun Dashboard](https://i.imgur.com/OfssVs1.png)
You can also specify whether the values are required, unique or read only.
Commun comes with a complete dashboard that you can use to manage your application without having to write any code.
#### Entity Join Attributes
The dashboard also works perfectly on mobile devices, so you can manage your app on the go.
Entities can have a list of join attributes, which are attributes fetched from another entity.
An use case of Join Attributes is to return for every item if the logged user likes it or not.
#### Entity Hooks
Entity hooks allow you to increment or set values on an item when certain event happens.
Supported lifecycle events:
- Before Get
- After Get
- Before Create
- After Create
- Before Update
- After Update
- Before Delete
- After Delete
Hooks also allow to specify a condition that must be true in order to execute.
For example, a `PostVote` entity which stores a vote of an user on a given post (1 or -1), hooks can be created to keep the number of up votes and down votes on the post.
#### Entity Indexes
Entities can specify a list of indexes that will be created on MongoDB.
### User Management
Commun includes a fully featured user system with authentication and permission management.
Supported authentication strategies include: Email & Password, Google, Facebook and GitHub.
**Provided APIs:**
* `[POST] /api/v1/auth/password`
- Creates a new user with email, username and password
- Sends an email with a code to verify the email
* `[POST] /api/v1/auth/password/login`
- Authenticates an user with email/username and password
- Returns refresh and access token
* `[POST] /api/v1/auth/token`
- Returns an access token given a refresh token
* `[POST] /api/v1/auth/verify`
- Verifies an user's email given the code sent after registration
* `[POST] /api/v1/auth/password/forgot`
- Sends a forgot password code by email
* `[POST] /api/v1/auth/password/reset`
- Allows to change a password, given a valid forgot password code
Users are entities, so you can also use all the entity APIs replacing `:entity` with `users`
## Production readiness

@@ -174,0 +75,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc