diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,22 @@
+Copyright (c) 2016, Sannsyn AS
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/hasql-optparse-applicative.cabal b/hasql-optparse-applicative.cabal
new file mode 100644
--- /dev/null
+++ b/hasql-optparse-applicative.cabal
@@ -0,0 +1,52 @@
+name:
+  hasql-optparse-applicative
+version:
+  0.1
+synopsis:
+  "optparse-applicative" parsers for "hasql"
+category:
+  Hasql, Database, PostgreSQL, Options
+homepage:
+  https://github.com/sannsyn/hasql-optparse-applicative 
+bug-reports:
+  https://github.com/sannsyn/hasql-optparse-applicative/issues 
+author:
+  Nikita Volkov <nikita.y.volkov@mail.ru>
+maintainer:
+  Nikita Volkov <nikita.y.volkov@mail.ru>
+copyright:
+  (c) 2016, Sannsyn AS
+license:
+  MIT
+license-file:
+  LICENSE
+build-type:
+  Simple
+cabal-version:
+  >=1.10
+
+
+source-repository head
+  type:
+    git
+  location:
+    git://github.com/sannsyn/hasql-optparse-applicative.git
+
+
+library
+  hs-source-dirs:
+    library
+  default-extensions:
+    Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFoldable, DeriveFunctor, DeriveGeneric, DeriveTraversable, EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs, GeneralizedNewtypeDeriving, LambdaCase, LiberalTypeSynonyms, MagicHash, MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude, NoMonomorphismRestriction, OverloadedStrings, PatternGuards, ParallelListComp, QuasiQuotes, RankNTypes, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TupleSections, TypeFamilies, TypeOperators, UnboxedTuples
+  default-language:
+    Haskell2010
+  other-modules:
+  exposed-modules:
+    Hasql.Options.Applicative
+  build-depends:
+    hasql >= 0.19 && < 0.20,
+    hasql-pool >= 0.4 && < 0.5,
+    -- 
+    optparse-applicative >= 0.12 && < 0.13,
+    -- 
+    base-prelude >= 0.1 && < 0.2
diff --git a/library/Hasql/Options/Applicative.hs b/library/Hasql/Options/Applicative.hs
new file mode 100644
--- /dev/null
+++ b/library/Hasql/Options/Applicative.hs
@@ -0,0 +1,68 @@
+module Hasql.Options.Applicative where
+
+import BasePrelude
+import Options.Applicative
+import qualified Hasql.Connection
+import qualified Hasql.Pool
+
+
+-- |
+-- Given a prefix for long names produces a parser of @Hasql.Pool.'Hasql.Pool.Settings'@.
+poolSettings :: Maybe String -> Parser Hasql.Pool.Settings
+poolSettings prefix =
+  (,,) <$> size <*> timeout <*> connectionSettings prefix
+  where
+    size =
+      option auto $
+        long (prefixed "pool-size") <>
+        value 1 <>
+        showDefault <>
+        help "Amount of connections in the pool"
+    timeout =
+      fmap fromIntegral $
+      option auto $
+        long (prefixed "pool-timeout") <>
+        value 10 <>
+        showDefault <>
+        help "Amount of seconds for which the unused connections are kept open"
+    prefixed s = 
+      maybe s (<> ("-" <> s)) prefix
+
+-- |
+-- Given a prefix for long names produces a parser of @Hasql.Connection.'Hasql.Connection.Settings'@.
+connectionSettings :: Maybe String -> Parser Hasql.Connection.Settings
+connectionSettings prefix =
+  Hasql.Connection.settings <$> host <*> port <*> user <*> password <*> database
+  where
+    host =
+      fmap fromString $ strOption $
+        long (prefixed "host") <> 
+        value "127.0.0.1" <>
+        showDefault <>
+        help "Server host"
+    port =
+      option auto $
+        long (prefixed "port") <>
+        value 5432 <>
+        showDefault <>
+        help "Server port"
+    user =
+      fmap fromString $ strOption $
+        long (prefixed "user") <>
+        value "postgres" <>
+        showDefault <>
+        help "Username"
+    password =
+      fmap fromString $ strOption $
+        long (prefixed "password") <>
+        value "" <>
+        showDefault <>
+        help "Password"
+    database =
+      fmap fromString $ strOption $
+        long (prefixed "database") <>
+        value "" <>
+        showDefault <>
+        help "Database name"
+    prefixed s = 
+      maybe s (<> ("-" <> s)) prefix
