diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) <year> <copyright holders>
+
+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/g-npm.cabal b/g-npm.cabal
new file mode 100644
--- /dev/null
+++ b/g-npm.cabal
@@ -0,0 +1,30 @@
+Name:                g-npm
+Version:             0.0.1
+Description:         Generate Gentoo ebuilds from NodeJS/npm packages.
+License:             MIT
+License-file:        LICENSE
+Category:            Tools
+Synopsis:            Generate Gentoo ebuilds from NodeJS/npm packages.
+Author:              Jesus Rivero (Neurogeek)
+Maintainer:          neurogeekster@gmail.com
+Package-url:         https://github.com/neurogeek/g-npm
+Build-Type:          Simple
+Cabal-Version:       >=1.6
+
+source-repository head
+  type: git
+  location: git://github.com/neurogeek/g-npm.git
+
+Executable g-npm
+  Main-is:           Main.hs
+  hs-source-dirs:    ., src
+
+  Build-Depends:     
+    base >= 3 && < 5,
+    HTTP >= 4000.2,
+    json
+
+  Other-modules:
+    Npm
+
+  GHC-Options: -fPIC
diff --git a/src/Main.hs b/src/Main.hs
new file mode 100644
--- /dev/null
+++ b/src/Main.hs
@@ -0,0 +1,58 @@
+module Main 
+where
+
+import Npm( doGetNpm, makeEbuildS, showNpmEbuild )
+import Control.Monad
+import System.Environment
+import System.Console.GetOpt
+
+-- Flag type for Options
+data Flag = NoDeps 
+        | PkgName String
+        | PkgVersion String
+        | Overlay String 
+        deriving (Show, Eq)
+
+-- Options type. 
+data Options = Options { optNoDeps :: Bool
+                , optOverlay :: String
+                , optPkgName :: String
+                , optPkgVersion :: String }
+                deriving Show
+
+-- Default options
+startOptions = Options { optNoDeps = False
+                , optOverlay = "" 
+                , optPkgName = ""
+                , optPkgVersion = "" }
+                
+
+-- Options.
+options :: [ OptDescr (Options -> IO Options) ]
+options = [ Option ['N'] ["no-deps"] (NoArg (\opt -> return opt {optNoDeps = True})) "Don't create ebuilds for dependencies.",
+    Option ['o'] ["overlay"] (ReqArg (\arg opt -> return opt {optOverlay = arg}) "DIR") "Path to the overlay where ebuils are to be written to.",
+    Option ['n'] ["pkg-name"] (ReqArg (\arg opt -> return opt {optPkgName = arg}) "NAME") "Name of the Npm package to build.",
+    Option ['v'] ["pkg-version"] (ReqArg (\arg opt -> return opt {optPkgVersion = arg}) "VER") "Version of the Npm package to build."]
+
+-- parseArgs
+-- Applies getOpt to the command line arguments.
+parseArgs :: [String] -> IO ([Options -> IO Options], [String])
+parseArgs args =
+    case getOpt RequireOrder options args of
+        (o,n,[]  ) -> return (o, n)
+        (_,_,errs) -> ioError (userError (concat errs ++ usageInfo header options))
+            where header = "Usage: g-npm [OPTION...]"
+
+-- Main
+main :: IO ()
+main = do
+    args <- getArgs
+    (opts, non_opts) <- parseArgs args
+    opts' <- foldl (>>=) (return startOptions) opts
+
+    pkg <- doGetNpm (optPkgName opts') (optPkgVersion opts')
+
+    case pkg of
+        Nothing -> ioError (userError ("Package " ++ (optPkgName opts') ++ " not found."))
+        Just pkg -> putStrLn $ (showNpmEbuild pkg)
+
diff --git a/src/Npm.hs b/src/Npm.hs
new file mode 100644
--- /dev/null
+++ b/src/Npm.hs
@@ -0,0 +1,115 @@
+{-- This module is used to create Npm data types from 
+ -  JSON descriptions, with queries made to the NPM Registry
+ -  (http://registry.npmjs.org) 
+ -  Author: Jesus Rivero <neurogeek@gentoo.org> --}
+
+module Npm
+    ( doGetNpm,
+      makeEbuildS,
+      showNpmEbuild,
+      Npm )
+where
+
+import Text.JSON
+import Network.HTTP
+
+-- Test Data
+jsStr :: String
+jsStr = "{\"name\":\"grunt-cli\",\"description\":\"The grunt command line interface.\",\"version\":\"0.1.8\",\"author\":{\"name\":\"Grunt Team\"},\"homepage\":\"http://gruntjs.com/\",\"repository\":{\"type\":\"git\",\"url\":\"git://github.com/gruntjs/grunt-cli.git\"},\"bugs\":{\"url\":\"http://github.com/gruntjs/grunt-cli/issues\"},\"licenses\":[{\"type\":\"MIT\",\"url\":\"http://github.com/gruntjs/grunt-cli/blob/master/LICENSE-MIT\"}],\"bin\":{\"grunt\":\"bin/grunt\"},\"engines\":{\"node\":\">= 0.8.0\"},\"scripts\":{\"test\":\"node bin/grunt test\"},\"preferGlobal\":true,\"dependencies\":{\"nopt\":\"~1.0.10\",\"findup-sync\":\"~0.1.0\",\"resolve\":\"~0.3.1\"},\"devDependencies\":{\"grunt\":\"~0.4.0\",\"grunt-contrib-jshint\":\"~0.2.0\"},\"contributors\":[{\"name\":\"Tyler Kellen\",\"url\":\"http://goingslowly.com\"},{\"name\":\"Ben Alman\",\"url\":\"http://gruntjs.com\"},{\"name\":\"Scott González\",\"url\":\"http://nemikor.com\"},{\"name\":\"Forbes Lindesay\",\"url\":\"https://github.com/\"}],\"readmeFilename\":\"README.md\",\"_id\":\"grunt-cli@0.1.8\",\"dist\":{\"shasum\":\"74b59b91487a4ce061a4001d592ddac85de402d2\",\"tarball\":\"http://registry.npmjs.org/grunt-cli/-/grunt-cli-0.1.8.tgz\"},\"_from\":\".\",\"_npmVersion\":\"1.2.15\",\"_npmUser\":{\"name\":\"tkellen\",\"email\":\"tyler@sleekcode.net\"},\"maintainers\":[{\"name\":\"cowboy\",\"email\":\"cowboy@rj3.net\"},{\"name\":\"tkellen\",\"email\":\"tyler@sleekcode.net\"}],\"directories\":{}}"
+
+-- Npm data. Represents a package.js from 
+-- an Npm package
+data Npm = Npm {
+        name :: String,
+        version :: String,
+        description :: String,
+        dependencies :: [(String, String)] }
+        deriving Show
+
+-- getNpmUrl - Returns the URL to query the NPM registry.
+getNpmUrl :: String -> String -> String
+getNpmUrl p v = "http://registry.npmjs.org/" ++ p ++ "/" ++ v
+
+-- Makes the HTTP request to the NPM Registry
+doGetNpm :: String -> String -> IO (Maybe Npm)
+doGetNpm p v = simpleHTTP (getRequest $ getNpmUrl p v)
+                    >>= fmap makeNpm . getResponseBody
+
+{--
+doGetNpmDeps :: IO (Maybe Npm) -> IO ([IO (Maybe Npm)])
+doGetNpmDeps f = fmap doGetNpmDeps' f
+    where
+        doGetNpmDeps' :: Maybe Npm -> [IO (Maybe Npm)]
+        doGetNpmDeps' n = map (\(p, v) -> doGetNpm p v) $ extractDeps n 
+
+        extractDeps :: Maybe Npm -> [(String, String)]
+        extractDeps (Just n) = dependencies n
+        extractDeps Nothing = [("", "")]
+
+--}
+--
+makeEbuild :: IO (Maybe Npm) -> IO (String)
+makeEbuild n = fmap doEbuild n
+    where
+        doEbuild :: Maybe Npm -> String
+        doEbuild (Just n) = show $ (name n) ++ (version n)
+        doEbuild Nothing = ""
+
+makeEbuildS :: Maybe Npm -> String
+makeEbuildS n = doEbuildS n
+    where
+        doEbuildS :: Maybe Npm -> String
+        doEbuildS (Just n) = showNpmEbuild n
+        doEbuildS Nothing = ""
+
+showNpmEbuild :: Npm -> String
+showNpmEbuild n = "# Copyright 1999-2013 Gentoo Foundation" ++ "\n" ++
+                  "# Distributed under the terms of the GNU General Public License v2" ++ "\n" ++
+                  "# $Header: $" ++ "\n" ++ 
+                  "\n" ++
+                  "EAPI=5" ++ "\n" ++
+                  "\n" ++
+                  "inherit multilib npm" ++ "\n" ++
+                  "\n" ++
+                  "DESCRIPTION=\"" ++ description n ++ "\"\n" ++
+                  "\n" ++
+                  "LICENSE=\"MIT\"" ++ "\n" ++
+                  "SLOT=\"0\"" ++ "\n" ++
+                  "KEYWORDS=\"~amd64 ~x86\"" ++ "\n" ++
+                  "IUSE=\"\"" ++ "\n" ++
+                  "DEPEND=\">=net-libs/nodejs-0.8.10\"" ++ "\n" ++
+                  "RDEPEND=\"${DEPEND}\"" ++ "\n"
+
+
+--
+-- Converts the resulting JSON from querying the NPM Registry,
+-- to actual Npm data.
+makeNpm :: String -> Maybe Npm
+makeNpm s = makeNpm' $ decode s
+    where
+        makeNpm':: Result (JSObject JSValue) -> Maybe Npm
+        makeNpm' (Ok x) = let a = (buildNpm x) in 
+                                if (name a) == "" then Nothing
+                                else Just a
+        makeNpm' _ = Nothing
+
+        getString (Ok s) = fromJSString s
+        getString _ = ""
+
+        getMaybeString (Ok s) = Just $ fromJSString s
+        getMaybeString _ = Nothing
+
+        getDepends :: Result (JSObject JSValue) -> [(String, String)]
+        getDepends (Ok s) = processDep $ fromJSObject s
+        getDepends _ = []
+
+        processDep :: [(String, JSValue)] -> [(String, String)]
+        processDep [] = []
+        processDep (x:xs) = [(fst x, (\(JSString s) -> fromJSString s) $ snd x)] ++ processDep xs
+
+        buildNpm x = Npm {
+            name = getString $ valFromObj "name" x,
+            version = getString $ valFromObj "version" x,
+            description = getString $ valFromObj "description" x,
+            dependencies = getDepends $ valFromObj "dependencies" x }
+
