Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@kfpersona/persona

Package Overview
Dependencies
Maintainers
5
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kfpersona/persona

🚧 user profile and identity management

  • 1.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
5
Weekly downloads
 
Created
Source

Persona

A user profile & identity management microservice.

Release Candidate

Slack

usage

Persona's main export is an express router, to be included in a parent application. an example instantiation is included in examples/app.ts, which is hooked up to the npm start script mentioned in the dev section below.

getting started
  • npm i --save @kfpersona/persona
  • add the required environment variables, documented in .env.schema
import * as express from 'express';
import * as cors from 'cors';
import createServer from '@kfpersona/persona';

const start = async () => {
  const port = 3232;
  const app = express();

  app.use(cors());

  app.use(
    await createServer({
      ego: {
        required: false,
        accessRules: [
          {
            type: 'deny',
            route: ['/', '/(.*)'],
            role: ['admin', 'user'],
          },
        ],
      },
      schemas: {
        User: {
          fields: {
            email: 'String',
            interests: ['String'],
          },
          collection: 'users',
        },
      },
      tags: {
        User: ['interests'],
      },
    }),
  );

  app.listen(port, () => console.log(`Listening on port: ${port}`))
};

start();

vault

persona supports vault integration by default. the USE_VAULT environment variable will determine whether or not persona should try to use vault to connect to mongo, or if it should use explicitly provided connection credentials.

migrations

depending on your usage the mongo instance backing persona may need migrations. persona provides migration support in the form of the persona-scripts.

persona migrations require the global installation of the migrate-mongo package, npm i -g migrate-mongo. for more information visit https://www.npmjs.com/package/migrate-mongo.

after installing persona, run persona-scripts migrate --args "<<migrate-mongo commands>>" from your project root to perform migration tasks. migrate-mongo commands include status, up, down, and create <<migration name>>

persona-scripts migrate will create a migrations/migrations directory structure in the root directory of your project.

environment variables

see .env.schema for details on environment variables

dev

  1. install dependencies
$ npm i
  1. make sure mongo is running
$ mongod
  1. start server (defaults to port :3232)
npm start
  1. personal is now running and you can access it http://localhost:3232/graphql

docker

To get a local instance of persona running you can use the docker compose file. This will start mongo and persona in docker.

$ docker-compose up --build

If you need a different port you can use the API_HOST_PORT env variable

$ API_HOST_PORT=3232 docker-compose up --build

FAQs

Package last updated on 14 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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