All Projects → LiveUI → Apicore

LiveUI / Apicore

Licence: apache-2.0
Core API functionality (users & teams, passwords, emails, etc) for any service built with Vapor 3

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Apicore

Vaporuploads
Demonstrating uploads in Vapor 4. Particularly large streaming uploads.
Stars: ✭ 19 (-55.81%)
Mutual labels:  server-side-swift, vapor
Steampress
A Blogging Engine and Platform written in Swift for use with the Vapor Framework
Stars: ✭ 337 (+683.72%)
Mutual labels:  server-side-swift, vapor
Vaporschool
Learn how to build vapor applications from rookie to champion in a constructive way!
Stars: ✭ 259 (+502.33%)
Mutual labels:  server-side-swift, vapor
Awesome Vapor
A curated list of Vapor-related awesome projects.
Stars: ✭ 783 (+1720.93%)
Mutual labels:  server-side-swift, vapor
Url Encoded Form
📝 Parse and serialize url-encoded form data with Codable support.
Stars: ✭ 32 (-25.58%)
Mutual labels:  server-side-swift, vapor
awesome-vapor
A curated list of Vapor-related awesome projects.
Stars: ✭ 907 (+2009.3%)
Mutual labels:  vapor, server-side-swift
Leaf
🍃 An expressive, performant, and extensible templating language built for Swift.
Stars: ✭ 310 (+620.93%)
Mutual labels:  server-side-swift, vapor
Stevenson
Stevenson is a Vapor framework designed to build integrations between Slack apps, GitHub, JIRA and CI services (CircleCI).
Stars: ✭ 57 (+32.56%)
Mutual labels:  vapor, server-side-swift
Stacked
Stack traces for Swift on Mac and Linux 📚
Stars: ✭ 24 (-44.19%)
Mutual labels:  server-side-swift, vapor
Vapor
💧 A server-side Swift HTTP web framework.
Stars: ✭ 21,194 (+49188.37%)
Mutual labels:  server-side-swift, vapor
template
A Vapor template for convenient and fast scaffolding 🏎
Stars: ✭ 33 (-23.26%)
Mutual labels:  vapor, server-side-swift
Swiftybeaver
Convenient & secure logging during development & release in Swift 3, 4 & 5
Stars: ✭ 5,392 (+12439.53%)
Mutual labels:  server-side-swift, vapor
sourcery-templates
Building Vapor projects using meta programming with Sourcery ✨
Stars: ✭ 24 (-44.19%)
Mutual labels:  vapor, server-side-swift
postgres-kit
🐘 Non-blocking, event-driven Swift client for PostgreSQL.
Stars: ✭ 125 (+190.7%)
Mutual labels:  vapor, server-side-swift
SwiftString
A comprehensive, lightweight string extension for Swift 3.x & 4.0
Stars: ✭ 117 (+172.09%)
Mutual labels:  vapor, server-side-swift
Jwt
Vapor JWT provider
Stars: ✭ 266 (+518.6%)
Mutual labels:  server-side-swift, vapor
flash
Flash messages between views ⚡️
Stars: ✭ 34 (-20.93%)
Mutual labels:  vapor, server-side-swift
bugsnag
Report errors with Bugsnag 🐛
Stars: ✭ 37 (-13.95%)
Mutual labels:  vapor, server-side-swift
Redis
Vapor provider for RediStack
Stars: ✭ 434 (+909.3%)
Mutual labels:  server-side-swift, vapor
Sockets
🔌 Non-blocking TCP socket layer, with event-driven server and client.
Stars: ✭ 559 (+1200%)
Mutual labels:  server-side-swift, vapor

ApiCore

Slack Jenkins Platforms Swift Package Manager Swift 4 Vapor 3

Base for API's that require user & team management including forgotten passwords, etc. This library should contain all the basic endpoints necessary to make your own SaaS platform similar to a github's own user management.

Warning!: This system is only designed to work with PostgreSQL at the moment!

Available endpoints

Install (available in DEBUG mode only!)

  • [GET] /install - install base data (admin user, team, etc. Can be also run after uninstall to restore all tables)
  • [GET] /uninstall - delete all tables (reversed migration)
  • [GET] /database - show content of the fluent table

Authentication

  • [GET] /auth - header based authentication (basic HTTP)
  • [POST] /auth - POST based authentication
  • [GET] /token - header based JWT token refresh
  • [POST] /token - POST based JWT token refresh
  • [GET] /logout - logout and delete ALL active tokens for the user
  • [POST] /logout - Logout and delete ALL active tokens for the user (POST)
  • [POST] /auth/password-check - Check password validity (is the password strong enough)
  • [POST] /auth/start-recovery - Start password recovery
  • [GET] /auth/input-recovery - HTML (templatable) based new password input
  • [POST] /auth/finish-recovery - Finish recovery (from HTML or redirect)

Server

  • [GET] /info - get server url, name and urls for server icons
  • [POST] /server/image - post a new server icon (will be used on default recovery html and as a favicon web based endpoints
  • [GET] /server/image/{icon_size} - get icon of a specific size (16, 64, 128, 192, 256 or 512px)
  • [GET] /server/image - 512px large icon
  • [DELETE] /server/image - delete server icon, default one will be used instead
  • [GET] /server/favicon - 16x16 px favicon (PNG format)
  • [GET] /server/security - Shows an array of security concerns ready to be displayed in user dialogs
  • [GET] /server/commit - Shows the content of a file ./Resources/commit.txt which can be edited during an automated deployment

Users

  • [GET] /users - get list of connected users within your teams (searchable)
  • [GET] /users/global - search users globally, personal info omitted, email MD5 added for Gravatar
  • [POST] /users - register new user
  • [GET] /users/verify - verify registered email (registration email/link is send to the user)
  • [POST] /users/disable - disable or enable a user (admin team members only)
  • [POST] /users/invite - Invite a user to join the system
  • [GET] /users/input-invite - HTML (templatable) based new user input
  • [POST] /users/finish-invitation - Processes data received from the above form

Teams

  • [GET] /teams - list all available teams
  • [GET] /teams/{team_id} - details on a specific team
  • [POST] /teams - create team
  • [GET] /teams/check - check if team identifier/name is available
  • [PUT] /teams/{team_id} - modify existing team
  • [GET] /teams/{team_id}/users - users linked to a specific team
  • [POST] /teams/{team_id}/link - link a user to a specific team
  • [POST] /teams/{team_id}/unlink - un-link a user from a specific team
  • [DELETE] /teams/{team_id} - delete a team

Misc

  • [GET] /errors - print out db archived error logs
  • [GET] /flush - flush system logs (often useful when running apps in docker)
  • [GET] /ping - find out if the server is alive
  • [GET] /teapot - find out if the server is a teapot

Install

Just add following line package to your Package.swift file.

.package(url: "https://github.com/LiveUI/ApiCore.git", .branch("master"))

Configuration

There is a few ways to configure ApiCore. The easiest is through the Environmental variables.

CONFIG_PATH            // Path to a configuration file (default one is included `config.default.json`)
APICORE.JWT_SECRET     // Secret passphrase to sign JWT tokens (mandatory in production)

Configuration file looks like this

{
	"general": {
		"single_team": false
	},
	"auth": {
		"allow_registrations": true,
		"allow_invitations": true,
		"registration_domains": []
	},
	"server": {
		"name": "Booster!",
		"url": "http://localhost:8080",
		"max_upload": 50
	},
	"jwt_secret": "secret",
	"database": {
		"host": "localhost",
		"port": 5432,
		"user": "boost",
		"password": "aaaaaa",
		"database": "boost",
		"logging": false
	},
	"mail": {
		"email": "[email protected]",
		"mailgun": {
			"domain": "sandbox-domain.mailgun.org",
			"key": "secret-key"
		}
    },
    "storage": {
        "local": {
	        "root": "/tmp/Boost"
        },
        "s3": {
	        "enabled": false,
			"bucket": "my-boost-appstore",
			"access_key": "my-access-key",
			"secret_key": "my-secret-key",
			"region": "us-east-1",
			"security_token": null
        }
    }
}

Each value can be set through a corresponding environmental variable in a number of formats

1) apicore.jwt_secret
2) APICORE.JWT_SECRET
3) apicore_jwt_secret
4) APICORE_JWT_SECRET

Integrationg ApiCore into a Vapor 3 app

To use ApiCore in an app, your configure.swift file could look something like this:

import Foundation
import Vapor
import DbCore
import MailCore
import ApiCore


public func configure(_ config: inout Config, _ env: inout Vapor.Environment, _ services: inout Services) throws {
    print("Starting ApiCore by LiveUI")
    sleep(10)
    Env.print()
    
    // Register routes
    let router = EngineRouter.default()
    try ApiCoreBase.boot(router: router)
    services.register(router, as: Router.self)
    
    // Go!
    try ApiCoreBase.configure(&config, &env, &services)
}

and main.swift somehow like that:

import ApiCoreApp
import Service
import Vapor

do {
    var config = Config.default()
    var env = try Environment.detect()
    var services = Services.default()
    
    // Setup ApiCore configure
    try ApiCoreApp.configure(&config, &env, &services)
    
    let app = try Application(
        config: config,
        environment: env,
        services: services
    )
    
    try app.run()
} catch {
    print("Top-level failure: \(error)")
}

Usage

TBD

Support

Join our Slack, channel #help-boost to ... well, get help :)

Boost AppStore

Core package for Boost, a completely open source enterprise AppStore written in Swift!

Other core packages

  • BoostCore - AppStore core module
  • MailCore - Mailing wrapper for multiple mailing services like MailGun, SendGrig or SMTP (coming)
  • DBCore - Set of tools for work with PostgreSQL database
  • VaporTestTools - Test tools and helpers for Vapor 3

Code contributions

We love PR’s, we can’t get enough of them ... so if you have an interesting improvement, bug-fix or a new feature please don’t hesitate to get in touch. If you are not sure about something before you start the development you can always contact our dev and product team through our Slack.

Author

Ondrej Rafaj (@rafiki270 on Github, Twitter, LiveUI Slack and Vapor Slack)

License

ApiCore is distributed under an Apache 2 license and can be shared or used freely within the bounds of the license itself. Most third party components used (like Vapor framework and all its components) in this software are MIT licensed. List of all used software is listed in the repository. All components are available in the dependencies folder.

See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].