{"id":13991597,"url":"https://github.com/phodal/lan","last_synced_at":"2025-04-04T11:11:22.602Z","repository":{"id":143884922,"uuid":"39864774","full_name":"phodal/lan","owner":"phodal","description":"Internet of Things Server Layer with CoAP, WebSocket, MQTT, HTTP Protocol.","archived":false,"fork":false,"pushed_at":"2020-04-28T10:33:35.000Z","size":523,"stargazers_count":566,"open_issues_count":0,"forks_count":198,"subscribers_count":83,"default_branch":"master","last_synced_at":"2025-03-28T10:05:45.968Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://lan.phodal.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phodal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2015-07-29T00:38:24.000Z","updated_at":"2025-02-24T21:16:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"c705e719-f2f2-4b12-85df-2904ad6b3978","html_url":"https://github.com/phodal/lan","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phodal%2Flan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phodal%2Flan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phodal%2Flan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phodal%2Flan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phodal","download_url":"https://codeload.github.com/phodal/lan/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247166168,"owners_count":20894654,"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","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-08-09T14:01:28.625Z","updated_at":"2025-04-04T11:11:22.584Z","avatar_url":"https://github.com/phodal.png","language":"JavaScript","readme":"# Lan IoT Server\n\n[![Build Status](https://travis-ci.org/phodal/lan.svg?branch=master)](https://travis-ci.org/phodal/lan)\n[![Code Climate](https://codeclimate.com/github/phodal/lan/badges/gpa.svg)](https://codeclimate.com/github/phodal/lan)\n[![Test Coverage](https://codeclimate.com/github/phodal/lan/badges/coverage.svg)](https://codeclimate.com/github/phodal/lan/coverage)\n\n\u003e Internet of Things Server Layer with CoAP, WebSocket, MQTT, HTTP Protocol.\n\nInspired by [Qest](https://github.com/mcollina/qest) \n\nTest on Node Version: ``v5``,``v6``\n\n## Architecture: \n\n![IoT Struct](docs/struct.png)\n\n详细可见：《自己动手设计物联网》\n\n![Designiot](docs/design-iot.jpg)\n\n立即购买：[亚马逊](https://www.amazon.cn/dp/B01IBZWTWW/ref=wl_it_dp_o_pC_nS_ttl?_encoding=UTF8\u0026colid=BDXF90QZX6WX\u0026coliid=I19EB97K0GNLW8)、[京东](http://search.jd.com/Search?keyword=%E8%87%AA%E5%B7%B1%E5%8A%A8%E6%89%8B%E8%AE%BE%E8%AE%A1%E7%89%A9%E8%81%94%E7%BD%91\u0026enc=utf-8\u0026wq=%E8%87%AA%E5%B7%B1%E5%8A%A8%E6%89%8B%E8%AE%BE%E8%AE%A1%E7%89%A9%E8%81%94%E7%BD%91\u0026pvid=k24y6hri.l4xi28)\n\n## Lan Server Layer:\n\n![Lan Struct](docs/iot.jpg)\n\n## 配置\n\n默认配置:\n\n```javascript\n{\n  \"encrypt\": \"crypto\",\n  \"db_url\": \"mongodb://localhost:27017/lan\",\n  \"db_collection\": \"documents\",\n  \"db_collection_user\": \"user\",\n  \"modules\": [\n    \"coap\",\n    \"http\",\n    \"mqtt\",\n    \"websocket\"\n  ],\n  \"port\": {\n    \"http\": 8899,\n    \"websocket\": 8898,\n    \"coap\": 5683,\n    \"mqtt\": 1883\n  },\n  \"logging\" :true,\n  \"secret\": \"keyboard cat\"\n}\n```\n\nencrypt: [\"crypto\", \"bcrypt\"]\n\nmodules: [\"coap\", \"http\", \"mqtt\", \"websocket\"]\n\nUse ``bcrypt``, please install it:\n\n    npm install --save bcrypt\n\n## Docker\n\n``Require``: Docker\n\n    docker build .\n\n## 安装(Setup)\n\n``必装``:\n\n1. MongoDB -\u003e NoSQL: 数据存储\n2. Sqlite || MySQL || PostgreSQL || MariaDB || MSSQL -\u003e SQL: 存储用户信息\n\n然后:\n\n1.Clone\n\n\tgit clone https://github.com/phodal/lan --recursive\n\n2.安装依赖\n\n    npm install\n    bower install \n    \n3.修改config下的配置\n\n    /config.json 数据库配置\n    /default.json Lan系统配置   \n\n4.数据库初始化\n\n    npm install -g sequelize-cli\n    sequelize db:migrate\n    \n5.Start Cron \n    \n    node jobs/cron.js\n    \n6.运行\n \n    npm start    \n    \n## Setup\n\n``require``: Install\n\n1. ``MongoDB``\n2. Sqlite || MySQL || PostgreSQL || MariaDB || MSSQL -\u003e SQL: save user info\n\nThen.\n\n1.Install dependencies\n\n    npm install\n\nOr Just Production only:\n\n    npm install --production\n\n2.Setup Database\n\n    sequelize db:migrate \n\n    \n3.Start Cron\n \n    node jobs/cron.js\n\n4.Run\n\n    npm start\n\n## Test With Tool\n\n### HTTP \n\nGet \n    \n    curl --user root:root -X GET -H \"Content-Type: application/json\" http://localhost:8899/topics/root\n\nPUT/POST - cUrl\n\n    curl --user root:root -X PUT -d '{ \"dream\": 1 }' -H \"Content-Type: application/json\" http://localhost:8899/topics/root\n\n### MQTT \n\nPublish - Mosquitto\n\n    mosquitto_pub -u root -P root -h localhost -d -t lettuce -m \"Hello, MQTT. This is my first message.\"\n\nSubscribe - Mosquitto\n\n    mosquitto_sub -t message -h localhost -u root -P root\n\n### CoAP \n\nPOST/PUT - libcoap\n\n    coap-client -e \"{message: 'hello,world}\" -m put coap://127.0.0.1/topic?root:root\n\nGET - libcoap\n\n    coap-client -m get coap://127.0.0.1:5683/topic?root:root\n    \nGET/POST/PUT - Copper\n    \n1. Visit [coap://127.0.0.1:5683/topic?root:root](coap://127.0.0.1:5683/topic?root:root)\n\nGET: Click ``GET``\n\nPOST: Type on ``Outgoing``, Click ``POST``\n\n### WebSocket\n\nMessage\n\n    node test_scripts/ws_test.js\n\n## Auth\n\nStandalone (单机)\n\n``User`` -\u003e ``SQL Database`` (Auth)\n\n``SQL Database`` -\u003e ``NoSQL`` (Save) \n\nMulti \n\n``User`` -\u003e ``SQL Database`` (Save)\n\n``SQL Database`` -\u003e ``NoSQL`` (Cron Job || MQ)\n \n``User`` -\u003e ``NoSQL`` (Auth \u0026\u0026 Save)\n\n## License\n\n© 2015~2016 [Phodal](https://www.phodal.com/). This code is distributed under the MIT license.\n\n","funding_links":[],"categories":["JavaScript","Platform"],"sub_categories":["Android Things"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphodal%2Flan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphodal%2Flan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphodal%2Flan/lists"}